# updatableMessage.setUpdatableMsg
Call this API at the server side. For more information, see Server API.
This API supports Cloud Calls. The WeChat DevTools version must be
1.02.1904090
or later (download the latest stable version here), and thewx-server-sdk
version must be0.4.0
or later.
Modifies the shared updatable message. For details, see Updatable Message.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send?access_token=ACCESS_TOKEN
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
access_token | string | Yes | Credentials to call API | |
activity_id | string | Yes | The ID of the updatable message. It is obtained via the updatableMessage.createActivityId API. | |
target_state | number | Yes | The state of the updatable message after modification. (For detailed meanings, see the following content.) | |
template_info | Object | Yes | The template information of the updatable message. |
Valid values of target_state
Value | Description | Minimum Version |
---|---|---|
0 | Not started yet | |
1 | Started |
template_info is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
parameter_list | Array.<Object> | Yes | The parameter to be modified in the template |
parameter_list is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
name | string | Yes | The parameter name to be modified | |
value | string | Yes | The modified value of the parameter |
Valid values of name
Value | Description | Minimum Version |
---|---|---|
member_count | It is required when target_state = 0 . It is the same as the value of member_count in the text content template. | |
room_limit | It is required when target_state = 0 . It is the same as the value of room_limit in the text content template. | |
path | The path used when "Enter" is tapped to start a Mini Program. It is required when target_state = 1 . In Mini Games, there are no pages, and therefore, it can be used to transfer query strings, for example, "?foo=bar" . | |
version_type | The version used when "Enter" is tapped to start a Mini Program. It is required when target_state = 1 . Valid values include develop (developer version), trial (test version), and release (official version). |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | number | Error message |
Valid values of errcode
Value | Description | Minimum Version |
---|---|---|
0 | Request successful | |
-1 | System is busy. Try again later. | |
42001 | access_token expired. | |
44002 | Empty POST data. | |
47001 | Parameters are missing in POST data. | |
47501 | Incorrect activity_id. | |
47502 | Incorrect target_state. | |
47503 | Incorrect version_type. | |
47504 | activity_id expired. |
# Message States
There are two message states (target_state), and each contains different text content and color. The text content template and colors cannot be changed.
State | Text Content | Color | State That Can Be Switched To |
---|---|---|---|
0 | "Members are joining. Currently, there are {member_count}/{room_limit} persons." | #FA9D39 | 0, 1 |
1 | "Started" | #CCCCCC | None |
The default validity period for an activity is 24 hours. At the end of the activity, the message content will take on a unified style:
- Text content: "Ended"
- Text color:
#00ff00
# Calling Example of curl
curl -d '{"activity_id": "966_NGiqxxxxxxxxx...xxxxxxxxE33BlwX", "target_state": 0, "template_info": {"parameter_list": [{"name": "member_count", "value": "2"}, {"name":"room_limit", "value": "5"} ] } }' \
'https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send?access_token=ACCESS_TOKEN'
# Cloud Call
Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via
wx-server-sdk
in the cloud function.
# API Calling Method
openapi.updatableMessage.setUpdatableMsg
You need to configure the permissions for the
updatableMessage.setUpdatableMsg
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
activityId | string | Yes | The ID of the updatable message. It is obtained via the updatableMessage.createActivityId API. | |
targetState | number | Yes | The state of the updatable message after modification. (For detailed meanings, see the following content.) | |
templateInfo | Object | Yes | The template information of the updatable message. |
Valid values of targetState
Value | Description | Minimum Version |
---|---|---|
0 | Not started yet | |
1 | Started |
templateInfo is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
parameterList | Array.<Object> | Yes | The parameter to be modified in the template |
parameterList is composed as follows
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
name | string | Yes | The parameter name to be modified | |
value | string | Yes | The modified value of the parameter |
Valid values of name
Value | Description | Minimum Version |
---|---|---|
member_count | It is required when target_state = 0 . It is the same as the value of member_count in the text content template. | |
room_limit | It is required when target_state = 0 . It is the same as the value of room_limit in the text content template. | |
path | The path used when "Enter" is tapped to start a Mini Program. It is required when target_state = 1 . In Mini Games, there are no pages, and therefore, it can be used to transfer query strings, for example, "?foo=bar" . | |
version_type | The version used when "Enter" is tapped to start a Mini Program. It is required when target_state = 1 . Valid values include develop (developer version), trial (test version), and release (official version). |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | number | Error message |
Valid values of errCode
Value | Description | Minimum Version |
---|---|---|
0 | Succeeded |
# Exceptions
# Object
Thrown Exceptions
Property | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | number | Error message |
Valid values of errCode
Value | Description | Minimum Version |
---|---|---|
-1 | System is busy. Try again later. | |
42001 | access_token expired. | |
44002 | Empty POST data. | |
47001 | Parameters are missing in POST data. | |
47501 | Incorrect activity_id. | |
47502 | Incorrect target_state. | |
47503 | Incorrect version_type. | |
47504 | activity_id expired. |