This article was originally published on 2023-05-24 and migrated here from an old blog. Compiled by: Hermes
Invalid Path Issue When Redirecting from WeChat Official Account Template Message to Mini Program
Problem Description
When sending notification messages via the Official Account and redirecting back to a specific page in the Mini Program, issues often arise where the miniprogram parameter's redirect path is invalid.
Official Documentation
WeChat Official Documentation - Sending Template Messages
Correct Format
{
"touser": "OPENID",
"template_id": "TEMPLATE_ID",
"page": "pages/index/index?id=123",
"miniprogram": {
"appid": "Mini Program AppID",
"pagepath": "pages/index/index?id=123"
}
}Important Notes
- Do not include query parameters after
?in thepageparameter. - The
pagemust be a valid page path configured within the Mini Program. - The path should not start with
/. - Ensure that the Mini Program has been published and is live.