May 19, 2021 WeChat Mini Program Development Document
This interface should be called on the server side, see Service API 。
This interface support Cloud call .Need Developer Tools> = 1.02.1904090 (Latest Stable version download )
wx-server-sdk >= 0.4.0
Modify the shared dynamic message.See Dynamic message 。
Call mode:
POST https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send?access_token=ACCESS_TOKEN
Attributes | type | Defaults | Required | illustrate |
---|---|---|---|---|
access_token | string | Yes | Interface call credential | |
activity_id | string | Yes | Dynamic message ID, get through the UpdatableMessage.createActivityID interface | |
target_state | number | Yes | Dynamic messages have been modified (see the specific meaning) | |
template_info | Object | Yes | Dynamic message corresponding to template information |
Target_State's legitimate value
value | illustrate | Minimum version |
---|---|---|
0 | has not started | |
1 | Start |
Template_info structure
Attributes | type | Defaults | Required | illustrate |
---|---|---|---|---|
parameter_list | Array.<Object> | Yes | Parameters that need to be modified in the template |
Parameter_list's structure
Attributes | type | Defaults | Required | illustrate |
---|---|---|---|---|
name | string | Yes | Parameter name to be modified | |
value | string | Yes | Modified parameter value |
The legal value of Name
value | illustrate | Minimum version |
---|---|---|
member_count |
target_state = 0
Always fill, text content template
member_count
Value
|
|
room_limit |
target_state = 0
Always fill, text content template
room_limit
Value
|
|
path |
target_state = 1
Always fill, click the path to start the applet when you enter the "Enter".
For small games, there is no page concept, you can use to pass query string (Query), such as
"?foo=bar"
|
|
version_type |
target_state the version used to start the small program by clicking "Enter" when it is required at
target_state = 1
Valid parameter values are:
develop
(development),
trial
(experience),
release
(official)
|
The returned JSON packet
Property | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | number | The error message |
The legal value of errcode
Value | Description | The lowest version |
---|---|---|
0 | The request was successful | |
-1 | The system is busy. Please ask the developer to try again later | |
42001 | access_token expires | |
44002 | The post data is empty | |
47001 | The parameters in the post data are missing | |
47501 | The activity_id error | |
47502 | The target_state error | |
47503 | The version_type error | |
47504 | activity_id expires |
The message has two states (target_state), each with its corresponding text content and color. Text content templates and colors do not support changes.
State | The content of the text | Color | The state in which the transfer is allowed |
---|---|---|---|
0 | "Members are joining, and there are currently member_count of people in room_limit. | #FA9D39 | 0, 1 |
1 | "Started" | #CCCCCC | No |
The default validity period for an activity is 24 hours. At the end of the event, the message content becomes a uniform style:
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 is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.
openapi.updatableMessage.setUpdatableMsg
Permissions for the updatableMessage.setUpdatableMsg API need to be configured in config.json, details
Property | Type | The default | Required | Description |
---|---|---|---|---|
activityId | string | Is | The ID of News Feed is obtained through the updatableMessage.createActivityId interface | |
targetState | number | Is | Status of News Feed modifications (see below for specific meanings) | |
templateInfo | Object | Is | The template information for News Feed |
The legal value of targetState
Value | Description | The lowest version |
---|---|---|
0 | Not started | |
1 | Has started |
The structure of templateInfo
Property | Type | The default | Required | Description |
---|---|---|---|---|
parameterList | Array.<Object> | Is | The parameters in the template that need to be modified |
The structure of the parameterList
Property | Type | The default | Required | Description |
---|---|---|---|---|
name | string | Is | The name of the argument to modify | |
value | string | Is | The modified parameter value |
The legal value of name
Value | Description | The lowest version |
---|---|---|
member_count |
target_state = 0
and the value of the member_count
member_count
the text template
|
|
room_limit |
target_state = 0
and the value of the text
room_limit
the text template
|
|
path |
target_state the path used to start the small program by clicking "Enter" when it is required at
target_state = 1
For games, there is no concept of a page that can be used to pass a query
"?foo=bar"
|
|
version_type |
target_state the version used to start the small program by clicking "Enter" when it is required at
target_state = 1
Valid parameter values are:
develop
(development),
trial
(experience),
release
(official)
|
The returned JSON packet
Property | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | number | The error message |
The legal value of errCode
Value | Description | The lowest version |
---|---|---|
0 | Success |
The exception thrown
Property | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | number | The error message |
The legal value of errCode
Value | Description | The lowest version |
---|---|---|
-1 | The system is busy. Please ask the developer to try again later | |
42001 | access_token expires | |
44002 | The post data is empty | |
47001 | The parameters in the post data are missing | |
47501 | The activity_id error | |
47502 | The target_state error | |
47503 | The version_type error | |
47504 | activity_id expires |