tencent cloud

All product documents
Tencent Cloud Super App as a Service
Subscription Message
Last updated: 2025-01-17 11:04:26
Subscription Message
Last updated: 2025-01-17 11:04:26



Note:
Only supported on SaaS.

Query personal template list

Request method: Get
Request URL: /openserver/wxaapi/newtmpl/gettemplate

Request parameters

Property
Type
‍Required
Description
access_token
string
True
Access token

Response parameters

Property
Type
Description
errmsg
string
Error message.
errcode
int32
Error code.
data
array<object>
Template list.
data.priTmplId
string
Template ID.
data.title
string
Title.
data.content
string
Content.
data.example
string
Example.
data.type
string
Type.
data.keywordEnumValueList
array<object>
Enumeration list.
data.keywordEnumValueList.keywordCode
string
Enumeration name.
data.keywordEnumValueList.enumValueList
array<string>
Enumeration values.
{
"data": [
{
"content": "testtest400:{{phrase1.DATA}}\ntesttest401:{{phrase2.DATA}}",
"example": "testtest400:testtest400\ntesttest401:testtest401",
"keywordEnumValueList": [
{
"enumValueList": [
"To be paid",
"Wait for delivery",
"Has been shipped",
"Completed",
"Canceled"
],
"keywordCode": "enum.DATA"
}
],
"priTmplId": "mti_oAWECeEacUIdYvUxSbJBNbkOIfzJHEcJIRSEMAE",
"title": "testtest400",
"type": 3
},
{
"content": "Order Number:{{thing1.DATA}}\nOrder type:{{thing2.DATA}}\nOrder Time:{{date.DATA}}\nOrder status:{{phrase.DATA}}",
"example": "Order Number:100020241130100001\nOrder type:Personal order\nOrder Time:2024/11/30 11:19:00\nOrder status:Pending shipment",
"keywordEnumValueList": [
{
"enumValueList": [
"To be paid",
"Wait for delivery",
"Has been shipped",
"Completed",
"Canceled"
],
"keywordCode": "enum.DATA"
}
],
"priTmplId": "mti_AgKglmMmSMbFVXBpaFunPSIoDGddPKSFGbSAYRe",
"title": "Received order notification",
"type": 2
}
],
"errcode": 0,
"errmsg": "ok",
"requestId": "19d63f1109f24857961de213bcfc7e75"
}

Send subscription messages

Request method: Post
Request URL: /openserver/cgi-bin/message/subscribe/send

Request parameters

Property
Type.
‍Required
Description
access_token
string
True
Access token for the API call. This parameter should be in the URL, not in the body.
template_id
string
True
The ID of the subscription template to be sent.
page
string
False
The page to navigate to when the template card is clicked. This must be a page within the mini program. Parameters can be included (e.g. index?foo=bar). If not provided, the template will not have a navigation link.
touser
string
True
The OpenID of the recipient (user).
data
string
True
Template content.
miniprogram_state
string
True
The type of mini program to navigate to: developer for the development version, trial for the Preview, formal for the official version. Defaults to the official version.
lang
string
True
Language types viewed in the mini program. Supported values are zh_CN (Simplified Chinese) and en_US (English).

Response parameters

Property
Type.
Description
errcode
number
Error code.
errmsg
string
Error message.
{"errcode":0,"errmsg":"ok"}

Additional description

Subscription message parameter value limitations

Parameter
Category
Parameter value limitations
Regular Expression
thing.DATA
Thing
Up to 20 characters
^[a-zA-Z0-9!@#$%^&*()_+={}\[\]:;\"\'<>,.?/~`-]{1,20}$
number.DATA
Number
Up to 32 numbers
^[0-9]{1,32}(\.[0-9]+)?$
letter.DATA
Letter
Up to 32 letters
^[a-zA-Z]{1,32}$
symbol.DATA
Symbol
Up to 5 symbols
^[^\w\s]{1,5}$
character_string.DATA
String
Up to 64 characters
^[a-zA-Z0-9\W_]{1,64}$
time.DATA
Time
24-hour time format, two times connected by a "~" symbol, format: hh: mm: ss or hh: mm
^(?:(?:([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?(?:~([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?)?)?)?$
date.DATA
Date
In the format of year, month, and day, connect two time with a "~" symbol. such as
yyyy-MM-dd hh:mm:ss or yyyy-MM-dd
^(\d{4}-[01]\d-[0-3]\d(?: (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d)?)(?:~(\d{4}-[01]\d-[0-3]\d(?: (?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d)?))?$
amount.DATA
Amount
1 currency symbol plus numbers with up to 10 numbers, and decimals are supported
^[A-Za-z$€¥]{1}[\d]{0,8}(\.\d{1,2})?$
phone_number.DATA
Phone number
Up to 17 characters. Numbers and symbols are allowed.
^[\d\-\+$$\s]{1,17}$
car_number.DATA
Car plate
Up to 12 characters
^.{1,12}$
name.DATA
Name
Up to 32 characters
^. {1,32}$
phrase.DATA
Description
Up to 16 characters
^.{1,16}$
For example, the content of the template could be:
Name: {{name01.DATA}}
Amount: {{amount01.DATA}}
Itinerary: {{thing01.DATA}}
Date: {{date01.DATA}}
The corresponding JSON:
{
"touser": "OPENID",
"template_id": "TEMPLATE_ID",
"page": "index",
"data": {
"name01": {
"value": "XX"
},
"amount01": {
"value": "$100"
},
"thing01": {
"value": "Guangzhou to Beijing"
},
"date01": {
"value": "2018-01-01"
}
}
}



Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon