3

I am trying to setup Wechat's sandbox account and I am following this site.

I am pointing the URL to my site and I've tried different settings for the Token. However, I am unable to press submit because I see this weird "Unable to configure" error without any explanation whatsoever.

Any ideas?

enter image description here

Tinker
  • 4,165
  • 6
  • 33
  • 72

2 Answers2

4

When you save your configuration, WeChat will try to send you a GET with an echostr query string. You must respond to that request with the content of that echostr value.

Here's an example in Node.js:

express.Router().get('/wechat', function(req, res) {
    res.send(req.query.echostr);
}

More information here: http://admin.wechat.com/wiki/index.php?title=Getting_Started

It is also possible that WeChat is just acting up, just keep trying to save until it works if you are sure that your webhook is correctly responding the echostr.

Obviously, you will need to handle the signature to make it secure and not listen to any requests that isn't coming from WeChat. Your shared token will be used to generate the signature. You must generate the same signature on your side and make sure it matches.

Signature validation is explained in Step 2 of the link mentioned earlier.

dannytranlx
  • 175
  • 8
-4

Your token is very short

you can generate token with appID and with secret using POSTMAN with link below

https://api.wechat.com/cgi-bin/token?grant_type=client_credential&appid=sandbox_test_account_app_id&secret=sandbox_test_account_secret

  • 1
    The token isn't the access token generated by WeChat. This token is the secret shared between WeChat and your webhook. It can be anything. – dannytranlx Jun 17 '16 at 18:05