This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.
API English Name: SendEmployeeRelationMsg
Sends template messages to users with an established employment relationship via Mini Program Merchant Assistant.
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/cgi-bin/message/wxopen/employeerelationmsg/send?access_token=ACCESS_TOKEN
Cloud Call
- This API does not support cloud call.
Third-party Call
- This API does not support third-party platform calls.
2. Request Parameters
Query Parameters Query String Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | string | Yes | ACCESS_TOKEN | API call credential, you can use access_token |
Request Body Request Payload
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| template_id | string | Yes | bV8Jk-XXXXXX | Message template ID |
| page | string | Yes | page/XXX | Jump path |
| touser | string | Yes | oL7T268t3zlOb64IvrN64-XXXXXX | OpenID of the recipient user |
| data | string | Yes | {\"data\":{\"character_string1\":{\"value\":\"aaa\"},\"amount1\":{\"value\":\"222\"}}} | Message content |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Example | Description |
|---|---|---|---|
| errcode | number | 0 | Error code |
| errmsg | string | ok | Error message |
4. Notes
No special notes for this API
5. Code Example
Request Example
{
"template_id": "bV8Jk-XXXXXX",
"page": "page/XXX",
"touser": "oL7T268t3zlOb64IvrN64-XXXXXX",
"data": "{\"data\":{\"character_string1\":{\"value\":\"aaa\"},\"amount1\":{\"value\":\"222\"}}}"
}
Response Example
{
"errcode": 0,
"errmsg": "ok"
}
6. Error Codes
The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.
| Error Code | Error Description | Solution |
|---|---|---|
| -1 | system error | The system is busy. Developers are advised to try again later. |
| 40097 | invalid args | Invalid parameter |
| 40256 | invalid employee relation | Pushing messages to a user who has no established employment relationship |
| 40257 | decode touser error | Failed to parse the recipient user's OpenID |
| 43104 | this app does not have poermission | The app does not have the permission to push template messages |
| 50001 | user unauthorized | The user has not subscribed to the template |
7. Applicable Scope
This API supports 「Mini Program」 account type calls. Other account types cannot call unless otherwise specified.