/v2/miniprogram/message/send
POST /v2/miniprogram/message/send
The send
API is used for Mini Program to allow merchants or Independent Software Vendors (ISV) to configure message templates, which facilitates merchants or ISV to send good-looking messages to users.
Message structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request
Property | Data Type | Required | Description | Example |
appId | String | Yes | In Mini Program, the app ID. Max. length: 32 characters. | "P000000000000001xxxx" |
accessToken | String | Yes | An access token is used to access the user resource scope. Max. length: 128 characters. | "2019112719074101000700000077771xxxx" |
requestId | String | Yes | A unique ID is associated with a message. For example, using this API to send a notification when the user completes a payment through the Mini Program, the value of the Max. length: 64 characters. | "20191127190741010007013213123xxxx" |
templateCode | String | Yes | The template that the merchant or ISV selects on the Mini Program SaaS portal. The message is sent based on the selected template. Max. length: 64 characters. | "TP_5800000001xxxx" |
redirectUrl | String | No | The mini program page is redirected after the user clicks the PUSH/INBOX message. Therefore, for the PUSH/INBOX message only, this property is required. Max. length: 2048 characters. | "/page/dasdas/12312" |
templates | Array<ContentTemplate> | Yes | A list of content templates of messages to send. The maximum array size is 5. | [ { "templateParameters": { "who": "string to represent a name, e.g. XiaoMing" }, "language": "en-US" } ] |
extendInfo | String | No | The extension information that wallets and merchants want to describe. Max. length: 4096 characters. | copy
|
Response
Property | Data type | Required | Description | Example |
result | Yes | The request result, which contains information such as status and error codes. | { "resultCode": "SUCCESS", "resultStatus": "S", "resultMessage": "success" } | |
extendInfo | String | No | The extension information that wallets and merchants want to describe. Max. length: 4096 characters. | copy
|
Result process logic
In the response, the result.resultStatus
field indicates the result of processing a request as follows.
resultStatus | Description |
S | The request of message sending is successful. The corresponding |
U | The API status is unknown.
The corresponding For details, see the Common error codes section. |
F | The message sending request fails. The corresponding |
Error codes
Error codes are usually classified into the following categories:
- Common error codes are common for all Mini Program OpenAPIs.
- API-specific error codes: the current OpenAPI does not have its dedicated error codes.
Sample

Request
{
"appId": "P000000000000001xxxx",
"accessToken": "2019112719074101000700000077771xxxx",
"redirectUrl": "20191127190741010007013213123xxxx",
"templateCode": "TP_5800000001xxxx",
"actionUrl":"/page/dasdas/12312",
"templates": [
{
"templateParameters": {
"who": "string to represent a name, e.g. XiaoMing"
},
"language": "en-US"
}
]
}
For example, the message template includes: Hello, ${who}
, then the message will be like: Hello, XiaoMing
.
Response
{
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S"
}
}