# Dynamic message
From the base library 2.4.0 Start, support forwarding dynamic messages. Dynamic messages compared to ordinary messages, the following characteristics:
- After the message is sent, the developer can modify it through the background interfacepartMessage content.
- The message has a corresponding reminder button, the user can click the reminder button to subscribe to the reminder, the developer can modify the message status through the background and push a reminder message to the user who subscribed to the reminder.
# Message properties
Dynamic messages have status, text content, text color, system message reminder.
# template
There are currently two templates for dynamic messaging, which are applied to the team scenario, respectivelyAt the beginningandBy the time of QiFor state changes and reminder nodes.
Change and Alert Nodes | Template ID |
---|---|
At the beginning | 21B034D08C5615B9889CE362BB957B1EE69A584B |
By the time of Qi | 666F374D69D16C932E45D7E7D9F10CEF6177F5F5 |
# state
Each template has three states, each with its corresponding text content and color. In which the state 0 Can be transferred to the state 0 and 1 and 2, State 1 Can be transferred to the state 2, State 2 Can't be moved.
At the beginning
state | Text content | colour | The state of being allowed to transfer |
---|---|---|---|
0 | "Members are joining, the current {member_count}/{room_limit} people " | #10AEFF | 0, 1, 2 |
1 | "started." | #07C160 | 2 |
2 | "Closed" | #CCCCCC | nothing |
When the members arrive
state | Text content | colour | The state of being allowed to transfer |
---|---|---|---|
0 | "Members are joining, the current {member_count}/{room_limit} people " | #10AEFF | 0, 1, 2 |
1 | "all present." | #07C160 | 2 |
2 | "Closed" | #CCCCCC | nothing |
Maintain state 0 No data incoming or status 1 Automatically enter the state after 24 hours 2。
# State parameter
Each state transition can carry parameters, as described below.
parameter | type | Introductions |
---|---|---|
member_count | string | state 0 Valid when the text content template member_count The value of |
room_limit | string | state 0 Valid when the text content template room_limit The value of |
path | string | state 1 When valid, clickGet intoThe path to use when starting the Mini Program. For small games, there is no notion of a page that can be used to pass a query character string, such as "?foo=bar" |
version_type | string | state 1 When valid, clickGet intoVersion to use when starting the Mini Program. Valid parameter values are:develop (Development Version),trial (Experience Edition),Release (Official Version) |
# System message
After the user clicks the card with dynamic messages to exit the Mini Program, the system message will be issued, and the system message content will be changed or a new system message will be issued when the state is transferred, the specific message content is as follows.
template | content |
---|---|
At the beginning | 1.In the beginning, please remind me 2.At the beginning, you will receive a reminder 3.Started, enter the "Mini Program" |
By the time of Qi | 1.When we're all here, please remind me 2.Members will receive a reminder when they arrive 3.Members have arrived, enter the "Mini Program" |
# Methods of Use
# I. Creation activity_id
Each dynamic message can be understood as an activity, which needs to be passed before the activity is initiated. [createActivityId ]((createActivityId )) Interface Creation activity_id
Subsequent forwarding of dynamic messages as well as updating of dynamic messages are required to pass in this activity_id
。
# II. Declaring the Message Type as Dynamic Message before Forwarding
By calling wx.updateShareMenu Interface, incoming isUpdatableMessage: true
, and templateInfo
、activityId
Parameters. among activityId
Obtained from step one.
wx.updateShareMenu({
withShareTicket: true,
isUpdatableMessage: true,
activityId: '', // activity ID
templateInfo: {
parameterList: [{
name: 'member_count',
value: '1'
}, {
name: 'room_limit',
value: '3'
}]
templateId: '21B034D08C5615B9889CE362BB957B1EE69A584B'
}
})
# III. Modifying the contents of dynamic messages
After the news is sent, it can be sent through the [setUpdatableMsg ]((setUpdatableMsg )) Modify the message content.
# Low Version Compatible
For versions of the client that do not support dynamic messages, a dynamic message is displayed as a normal message when received