Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to retrieve kintone record information in Wechat

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to retrieve kintone record information in Wechat". The content is simple and clear. I hope it can help you solve your doubts. Now let the editor lead you to study and learn "how to retrieve kintone record information in Wechat".

What it will look like when it's finished.

Prepare kintone Settings

First of all, create the kintone application according to the above idea. What I create is a simple version of the enterprise information management application.

Field type field name field code remarks creator

Creation time

Single-line text box company name company

Set as required

The value is unique

Single-line text box company representative representative

Single-line text box region area

Address where the single-line text box is located

Single-line text box company phone tel

After the application is created successfully, enter three pieces of data

Wechat official account setting

1. Visit Wechat public platform, click "enter Wechat public account test application system", and apply for Wechat public account test account

two。 Enter the Wechat public test account.

In the test number management page, we can see appID and appsecret. Write down these two pieces of information, which will be useful next.

3. Fill in the interface configuration information

This information requires its own server resources. There are a lot of CVM resources on the Internet, and you are free to choose.

If you have a server with public network ip, you can also use it. Here we mainly use php environment (server configuration method is omitted)

Next, write the server verification code to make it respond correctly to the Token authentication sent by Wechat. For more information, please refer to the access Guide.

Code

Class WeChat {private $_ appid; private $_ appsecret; private $_ token; public function _ construct ($appid, $appsecret, $token) {$this- > _ appid = $appid; $this- > _ appsecret = $appsecret; $this- > _ token = $token;} public function valid () {$echoStr = $_ GET ["echostr"] / / valid signature, option if ($this- > checkSignature ()) {echo $echoStr; exit;}} private function checkSignature () {$signature = $_ GET ["signature"]; $timestamp = $_ GET ["timestamp"]; $nonce = $_ GET ["nonce"]; $token = $this- > _ token $tmpArr = array ($token, $timestamp, $nonce); sort ($tmpArr); $tmpStr = implode ($tmpArr); $tmpStr = sha1 ($tmpStr); if ($tmpStr = = $signature) {return true;} else {return false;}}

Click "modify" on the interface configuration information, fill in the URL and Token, and click the "submit" button.

If you see the following information, the configuration is successful.

Associated with kintone

Here is the main schematic. Wechat forwards the message to the server, which interacts with kintone, and then returns the result to the official account.

For interaction with kintone, we mainly use the curl tool and kintone's API to retrieve records. For more information, please refer to php documents and kintone API: get records in batches (specify conditions in the query).

/ / request header $header = array ("Host:". $this- > _ subDomain. ".cybozu.com: 443", "X-Cybozu-API-Token:". $this- > _ apiToken); $queryStr = 'company like ". $keyword.'"'; $params = "? app=$this- > _ appId&query=" .urlencode ($queryStr). "& fields [0] =". Urlencode ("company"). "& fields [1] =". Urlencode ("representative"). "& fields [2] =". Urlencode ("area"). "& fields [3] =". Urlencode ("address"). "& fields [4] =". Urlencode ("tel"); $url = "https://". $this- > _ subDomain. ".cybozu.com / k/v1/records.json" $params;$response = $this- > _ request ($url, true, "get", null, $header); / / curl submission $result = json_decode ($response, true); if (count ($result ["records") > 0) {foreach ($result ["records"] as $value) {if ($contentStr! =') {$contentStr. = "\ n\ n";} $contentStr. = "Company name:". Value ["company"] ["value"]. "\ n". Company representative: Value ["representative"] ["value"]. "\ n". "region:" Value ["area"] ["value"]. "\ n". Location:. Value ["address"] ["value"]. "\ n". "phone:" $value ["tel"] ["value"];}} else {$contentStr = "the enterprise information not found";} above is all the content of the article "how to retrieve kintone record information in Wechat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report