没有不值得去解决的问题,也没有不值得去学习的技术!

Troubleshooting errcode 40132 When Calling the WeChat Official Account Preview API

Check the return code description, which indicates the cause: invalid WeChat ID.

1. Review the development documentation for the preview interface [available for both subscription and service accounts after verification]. See Figure 1.

Review the development documentation for the preview interface [available for both subscription and service accounts after verification]
Figure 1

2. After the actual call, the response returned an error: errcode: 40132, errmsg: invalid username rid: 60dac95d-5c42d192-50f09436.

Plaintext

Array
(
    [code] => 200
    [status] => OK
    [responseline] => HTTP/1.0 200 OK
    [headers] => Array
        (
            [Connection] => close
            [Content-Type] => application/json; encoding=utf-8
            [Date] => Tue, 29 Jun 2021 07:18:54 GMT
            [Content-Length] => 77
        )

    [content] => {"errcode":40132,"errmsg":"invalid username rid: 60dac95d-5c42d192-50f09436"}
    [meta] => HTTP/1.0 200 OK
Connection: close
Content-Type: application/json; encoding=utf-8
Date: Tue, 29 Jun 2021 07:18:54 GMT
Content-Length: 77

{"errcode":40132,"errmsg":"invalid username rid: 60dac95d-5c42d192-50f09436"}
)

3. Check the return code description, which indicates the cause: invalid WeChat ID. See Figure 2.

Check the return code description, which indicates the cause: invalid WeChat ID.
Figure 2

4. Check the request parameters: touser=13980000000, which is a mobile phone number. See Figure 3.

Check the request parameters: touser=13980000000, which is a mobile phone number.
Figure 3

5. Modify the request parameter to touser=shuijingsewwwwqnwq66tt, which is a WeChat ID. The response is successful. See Figure 4.

Modify the request parameter to touser=shuijingsewwwwqnwq66tt, which is a WeChat ID. The response is successful.
Figure 4
Plaintext

Array
(
    [code] => 200
    [status] => OK
    [responseline] => HTTP/1.0 200 OK
    [headers] => Array
        (
            [Connection] => close
            [Content-Type] => application/json; encoding=utf-8
            [Date] => Tue, 29 Jun 2021 07:31:01 GMT
            [Content-Length] => 40
        )

    [content] => {"errcode":0,"errmsg":"preview success"}
    [meta] => HTTP/1.0 200 OK
Connection: close
Content-Type: application/json; encoding=utf-8
Date: Tue, 29 Jun 2021 07:31:01 GMT
Content-Length: 40

{"errcode":0,"errmsg":"preview success"}
)

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系