forked from nxtele/http-api-document
-
Notifications
You must be signed in to change notification settings - Fork 1
WhatsApp API updateTemplate
CodingMakeWordBetter edited this page Jun 14, 2023
·
3 revisions
Edit a specified message template for a specific number in the WhatsApp application.
Please note that if a rich media interactive template was used when creating the template, a rich media sample file must be submitted along with it. The rich media sample file is uploaded through the "Template Sample Media Upload" API interface.
- URL:
https://api2.nxcloud.com/api/wa/updateTemplate - Method:
POST - Content-Type:
application/json - Requires authentication: Yes
Please refer to the following link for authentication rules: API Interface Call Convention
| Parameter Name | Type | Required | Example Value | Description |
|---|---|---|---|---|
| accessKey | String | Yes | fmexxx3ki | User identity identifier |
| ts | String | Yes | 1655710885431 | Current timestamp of the request (in milliseconds). The maximum time difference allowed between the client and the NiuXin server is 60 seconds. |
| bizType | String | Yes | 2 | WhatsApp business type, fixed value: "2" |
| action | String | Yes | updateTemplate | WhatsApp business operation, fixed value: "updateTemplate" |
| sign | String | Yes | 6e95xxx826 | API parameter signature. Signature Algorithm |
| Parameter Name | Type | Required | Example Value | Description |
|---|---|---|---|---|
| appkey | String | Yes | Appkey of the NiuXin Cloud WhatsApp application | |
| business_phone | String | Yes | 86158xxx1795 | WhatsApp number list of the merchant, including the country code, e.g., 185xxx99 |
| messaging_product | String | Yes | Channel for sending messages, must be set to "whatsapp" for WhatsApp messages | |
| template_id | String | Yes | Template ID | |
| components | array[component object] | Yes | Template components |
- component object parameters:
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| type | string | Required | Component type, including: HEADER, BODY, FOOTER, BUTTONS |
| format | string | Required/Optional | Only required for type=HEADER and not required for other types. Describes the type of content in the HEADER. Possible values: TEXT, DOCUMENT, IMAGE, VIDEO |
| text | string | Required/Optional | Required for type=HEADER and format=text; required for type=BODY; required for type=FOOTER; not required for type=BUTTONS. |
| example | object | Required/Optional | Variable example. Required when variables are configured in the HEADER or BODY content, otherwise not required. |
| buttons | array[button object] | Required/Optional | Required for type=BUTTONS; otherwise not required. |
| add_security_recommendation | boolean | Required/Optional | Add security recommendation. Optional for identity verification templates with type = BODY. Value: true/false. |
| code_expiration_minutes | integer | Required/Optional | Expiration |
time of the verification code. Optional for identity verification templates with type = FOOTER. Allowed value range: 1-90.
- example object parameters:
| Parameter Name | Type | Required/Optional | Description |
|---|---|---|---|
| header_handle | string | Required/Optional | Required when format=DOCUMENT or format=IMAGE or format=VIDEO in HEADER, otherwise not required |
| header_text | array[string] | Required/Optional | Required when format=TEXT in HEADER, otherwise not required |
| body_text | array[string] | Required/Optional | Required when variables are configured in the BODY content. The array may contain one or more values depending on the variable configuration. Not required if no variables are configured in the BODY content. |
- button object parameters:
| Parameter Name | Type | Required/Optional | Description |
|---|---|---|---|
| type | string | Required/Optional | Button type, including QUICK_REPLY, URL, PHONE_NUMBER QUICK_REPLY: quick reply button; URL: action call URL button PHONE_NUMBER: action call phone number button |
| text | string | Required | Display text of the button |
| url | string | Required/Optional | URL configured on the action call button. Required only for type=URL. If it's a dynamic URL, the suffix variable {{1}} should be included. |
| phone_number | string | Required/Optional | Phone number configured on the action call button. Required only for type=PHONE_NUMBER. |
| example | array[string] | Required/Optional | Example URL. Required for type=URL and dynamic URL, for example: https://www.baidu.com/user |
| otp_type | string | Required/Optional | Verification code button type. Fixed values: ONE_TAP or COPY_CODE. The meaning of ONE_TAP is one-tap autofill, and the meaning of COPY_CODE is copying the verification code. |
| autofill_text | string | Required/Optional | Autofill button text displayed on the button. Required only for otp_type=ONE_TAP. |
| package_name | string | Required/Optional | Android package name. Required only for otp_type=ONE_TAP. |
| signature_hash | string | Required/Optional | Application hash. Required only for otp_type=ONE_TAP. |
Body (application/json) parameters:
{
"appkey": "8exxxs",
"messaging_product": "whatsapp",
"business_phone": "185xxx99",
"template_id": "15125xxxx5168",
"components": [
{
"type": "BODY",
"text": "Your code is {{1}}, please do not share with others update.",
"example": {
"body_text": [
[
"10086"
]
]
}
}
]
}| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Result code |
| data | JsonObject | Request result |
| message | String | Description of the request result |
- data JsonObject parameters:
| Parameter Name | Type | Description |
|---|---|---|
| id | String | Template ID |
{
"code": 0,
"data": {
"id": "900xxx0755"
},
"message": "Request successful"
}{
"code": -1,
"message": "Request failed",
"data": null
}| code | message | Solution |
|---|---|---|
| 0 | Request successful | |
| -1 | Request failed | Please contact technical support to troubleshoot the issue. |
| 1000~100X | Authentication issue | Refer to the API authentication section for details. |
| 9000 | Parameter exception | Missing parameters, please check the required parameters. |
| 9001 | System business error | Please contact technical support to troubleshoot the issue. |
| 9002 | Merchant phone number error | Please confirm whether the merchant number belongs to a WhatsApp number. |
| 9006 | The WhatsApp number is not bound to the application | Please contact the business personnel to handle the binding operation between the application and the phone number. |
Introduction
- Send Message
- Mark Incoming Message as Read
- Upload Media File
- Get Media File
- Delete Media File
- Webhook
- Query Number Information
- Query Message Template
- Create Message Template
- Edit Message Template
- Delete Message Template
- Upload Template Example File
- Embedded Page Login
- Create Client Application
- List of Phone Numbers for Client Application
- Get Verification Code
- Verify Verification Code
- Create Local Client
Short message
Voice
Call Center(NXLink)
- Web Iframe
- Manual Dial Record
- Manual Dial Record Query By orderId
- List Agent Information
- List Agent Status
- List Queue
- List Agents In Queue
- List Agent Efficiency
- Update Queue Agents
- Create AutoDial Task
- Webhook - Manual Dial
Call Center(Callbot)
- Callbot API Summary
- Callbot API Authorization
- Callbot API Ping
- Create Auto Dial Task
- Add Contact List To Task
- Create Task And Add Contact
- Start Or Pause Task
- Update Task Parameters
- Get List Task
- List Call
- List Task Orders
- Stop Order
- Get Call Detail By Order
- Webhook - By Call
- Webhook - By Order
- Webhook - Task Status
Flash Call
Short links
邮件验证码
DID号码
通用
号码检测