Send Device Message

Last edited on 2026-03-16

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: sendHardwareDeviceMessage

Send a device message to the user through this API.

1. Call Method

HTTPS Call

POST https://api.weixin.qq.com/cgi-bin/message/device/subscribe/send?access_token=ACCESS_TOKEN

Cloud Call

  • This API does not support cloud call.

Third-party Call

  • This API supports third-party platforms on behalf of Merchant call.

  • The permission set ID of this API is: 118

  • After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.

2. Request Parameters

Query Parameters Query String Parameters

ParameterTypeRequiredDescription
access_tokenstringYesAPI call credential, you can use access_token, authorizer_access_token

Request Body Request Payload

ParameterTypeRequiredDescription
template_idstringYesThe ID of the subscription template to be delivered.
snstringYesThe unique serial number of the device. Assigned by the manufacturer, with a length not exceeding 128 bytes. Characters must be limited to digits, uppercase and lowercase letters, underscores (_), and hyphens (-).
pagestringYesThe page to navigate to after clicking the template card. Limited to pages within this Mini Program. Supports parameters (e.g., index?foo=bar). If this field is empty, the template will have no navigation.
to_openid_listarrayYesList of openid values for the recipients (users).
miniprogram_statestringNoThe Mini Program version type for navigation: developer for the Development version; trial for the Trial version; formal for the Release version. The default is the Release version.
modelIdstringYesThe device model ID, obtained during device registration.
datastringYesThis is an object, not a string. The template content, in the format { "key1": { "value": "xxx" }, "key2": { "value": "xxx" } }, where value is an enum value.
langstringYesThe language type for the "Go to Mini Program " text. Supports zh_CN (Simplified Chinese), en_US (English), zh_HK (Traditional Chinese), and zh_TW (Traditional Chinese). The default is zh_CN.

3. Response Parameters

Response Body Response Payload

ParameterTypeDescription
errcodenumberError code
errmsgstringError message

4. Notes

Call limit: 10,000,000 per day.

5. Code Example

Request Example

{
  "to_openid_list": [
    "OPENID_1",
    "OPENID_2"
  ],
  "sn": "XXXXXXX",
  "template_id": "TEMPLATE_ID",
  "page": "index",
  "miniprogram_state": "formal",
  "lang": "zh_CN",
  "data": {
    "time1": {
      "value": "2021-09-10 19:00:00"
    }
  }
}

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 CodeError DescriptionSolution
-1system errorThe system is busy. Please wait and try again later.
40037invalid template_idInvalid template_id.
41030invalid pageIncorrect page path. Ensure the page exists in the current online version of Mini Program and is consistent with app.json.
43101user refuse to accept the msgThe user declined the message. If the user had previously subscribed, this indicates that the user has unsubscribed.
47003argument invalid!Invalid template parameters. They may be empty or fail to meet the rules. The errmsg field will specify which field caused the error.

7. Applicable Scope

The callable account types for this API are not yet clear, or are determined by the calling parameters in business. Please refer to the actual calling situation.