forked from nxtele/http-api-document
-
Notifications
You must be signed in to change notification settings - Fork 1
WhatsApp API getTemplate
CodingMakeWordBetter edited this page Jun 14, 2023
·
8 revisions
Query the message template bound to a single number under the WhatsApp application through API.
- URL:
https://api2.nxcloud.com/api/wa/getTemplate - Method:
POST - Content-Type:
application/json - Authentication required: Yes
Please refer to the following link for authentication rules: API Interface Call Convention
| Parameter Name | Type | Required | Example | Description |
|---|---|---|---|---|
| accessKey | String | Yes | fmexxx3ki | User identity identifier |
| ts | String | Yes | 1655710885431 | Timestamp of the current request (in milliseconds) |
| bizType | String | Yes | 2 | WhatsApp business type, fixed value: "2" |
| action | String | Yes | getTemplate | WhatsApp business operation, fixed value: "getTemplate" |
| sign | String | Yes | 6e95xxx826 | API input parameter signature, signature algorithm |
| Parameter Name | Type | Required | Example | Description |
|---|---|---|---|---|
| appkey | String | Yes | Appkey of the NiuXin Cloud WhatsApp application | |
| business_phone | String | Yes | 86158xxx1795 | WhatsApp number list of the merchant, with country code, e.g., 185xxx99 |
| messaging_product | String | Yes | Channel for sending messages, must be set to "whatsapp" | |
| after | String | No | Cursor value for pagination to retrieve the next page | |
| before | String | No | Cursor value for pagination to retrieve the previous page | |
| limit | Integer | No | Number of templates per page (default value is 20 if empty) | |
| name | String | No | Template name (returns templates with the same name in different languages) |
Body (application/json) parameters:
{
"business_phone": "185xxx99",
"appkey": "jh42xxxd434",
"messaging_product": "whatsapp"
}| Parameter Name | Type | Description |
|---|---|---|
| code | Integer | Result code |
| data | JsonObject | Request result |
| message | String | Explanation of the request result |
- data (JsonObject parameters):
| Parameter Name | Type | Description |
|---|---|---|
| data | array[templateInfo object] | Array of template information |
| paging | object | Pagination information |
- templateInfo object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| id | string | Template ID |
| category | string | Template type |
| language | string | Template language |
| name | string | Template name |
| status | string | Audit Status Enum Enumeration Values: APPROVED: In Use IN_APPEAL: Appeal Submitted PENDING: Pending REJECTED: Rejected PENDING_DELETION: Pending Deletion DELETED: Deleted DISABLED: Disabled PAUSED: Temporarily Paused LIMIT_EXCEEDED: Limit Exceeded |
| rejected_reason | string | Rejection reason |
| quality_score | object | Template quality |
| components | array[component object] | Template components |
- quality_score object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| score | string | Template Quality Enum Enumeration Values: GREEN: High YELLOW: Medium RED: Low UNKNOWN: Quality Undetermined |
- component object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| type | string | Component type, including: HEADER, BODY, FOOTER, BUTTONS |
| format | string | Only available when type=HEADER, describing the type of content in HEADER, including TEXT, DOCUMENT, IMAGE, VIDEO |
| text | string | When type=HEADER and format=text, it represents the HEADER text content; when type=BODY, it represents the BODY text content; when type=FOOTER, it represents the FOOTER text content |
| example | object | Variable examples. When variables and example values are configured in HEADER or BODY content, this parameter is available |
| buttons | array[button object] | Only available when type=BUTTONS, describing the configuration information of template buttons |
- example object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| header_handle | string | Header media resource link |
| header_text | array[string] | Header text variable example, with only one value in the array |
| body_text | array[string] | Content text variable example, depending on the configuration of the template BODY, there may be one or more values in the array |
- button object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| type | string | Button Types, including QUICK_REPLY, URL, PHONE_NUMBER,QUICK_REPLY refers to quick reply buttons.URL refers to a button with a call-to-action URL.PHONE_NUMBER refers to a button with a call-to-action phone number. |
| text | string | Displayed text on the button |
| url | string | URL configured on the action button, only available when type=URL |
| phone_number | string | Phone number configured on the action button, only available when type=PHONE_NUMBER |
| example | array[string] | URL example, e.g., https://www.baidu.com/user |
- paging object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| cursors | object | Cursors |
| next | string | next is not empty for next page |
| previous | string | previous is not empty for previous page |
- cursors object parameters:
| Parameter Name | Type | Description |
|---|---|---|
| before | string | Cursor value (previous page) |
| after | string | Cursor value (next page) |
{
"code": 0,
"data": {
"data": [
{
"components": [
{
"format": "TEXT",
"text": "ni{{1}}hao",
"type": "HEADER",
"example": {
"header_text": [
"AA"
]
}
},
{
"text": "hello{{1}}world{{2}}hahah",
"type": "BODY",
"example": {
"body_text": [
[
"BB",
"CC"
]
]
}
},
{
"text": "I am footer",
"type": "FOOTER"
},
{
"buttons": [
{
"text": "I am QR1",
"type": "QUICK_REPLY"
},
{
"text": "I am QR2",
"type": "QUICK_REPLY"
}
],
"type": "BUTTONS"
}
],
"rejected_reason": "INVALID_FORMAT",
"quality_score": {
"score": "UNKNOWN"
},
"name": "normal_text3",
"language": "en_US",
"id": "15xxxx67",
"category": "OTP",
"status": "REJECTED"
}
],
"paging": {
"next": "https://graph.facebook.com/v15.0/10xxx925/message_templates?fields=id%2Ccategory%2Clanguage%2Cname%2Cstatus%2Ccomponents%2Crejected_reason%2Cquality_score&limit=20&after=MTkZD",
"cursors": {
"before": "MAZDZD",
"after": "MTkZD"
}
}
},
"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 issues | See 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 if the merchant number belongs to a WhatsApp number |
| 9006 | The WhatsApp number is not bound to an application | Please contact the business personnel to handle the application and phone number binding operation |
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号码
通用
号码检测