圖形 API 版本

WhatsApp Message Template

Represents a specific message template. Make the API call to the message template ID.

To find a message template ID, call https://graph.facebook.com/v19.0/{whatsapp-business-account-ID}/message_templates.

For more information on how to use the API, see WhatsApp Business Management API.

閱讀中

Retrieves information about the message template

Example

Requirements

  • whatsapp_business_management permission

  • whatsapp_business_messaging permission

  • public_profile permission

  • WHATSAPP MESSAGE TEMPLATE ID

  • USER ACCESS TOKEN

Request

curl -i -X GET \
 "https://graph.facebook.com/LATEST-VERSION/WHATS-APP-MESSAGE-TEMPLATE-ID?access_token=USER-ACCESS-TOKEN"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/WHATS-APP-MESSAGE-TEMPLATE-ID",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/WHATS-APP-MESSAGE-TEMPLATE-ID"
           parameters:nil
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];

Response

{
  "name": "shiptest",
  "components": [
    {
      "type": "BODY",
      "text": "testing"
    }
  ],
  "language": "en_US",
  "status": "REJECTED",
  "category": "TRANSACTIONAL",
  "id": "WHATS-APP-MESSAGE-TEMPLATE-ID"
}

參數

這個端點沒有任何參數。

欄位

欄位說明
id
numeric string

ID

category
enum

The category type of the message template

components

An array of JSON objects describing the message template components.

cta_url_link_tracking_opted_out
bool

Optional boolean field for opting out/in of link tracking at template level

language
string

The language (and locale) of the element translation

library_template_name
string

Template Library name that this HSM is clone from

message_send_ttl_seconds
integer

Template message delivery retry time-to-live (TTL) override value. If unable to deliver the template message to the WhatsApp user, we will periodically retry for this period of time. If we are unable to deliver the message for this period of time, the message will be dropped.

Only allowed for authentication message templates. See Time-To-Live.

name
string

The message template name

previous_category
enum

Previous category of the template. See Template Categories.

quality_score

Quality score of the HSM

rejected_reason
enum

The reason the message template was rejected

enum {ABUSIVE_CONTENT, INVALID_FORMAT, NONE, PROMOTIONAL, TAG_CONTENT_MISMATCH, SCAM}

status
enum

The status of the message template

enum {APPROVED, IN_APPEAL, PENDING, REJECTED, PENDING_DELETION, DELETED, DISABLED, PAUSED, LIMIT_EXCEEDED}

sub_category
enum

Sub category of the template

關係連線

關係連線說明
Edge<WhatsAppBusinessHSMComparison>

compare

Error Codes

錯誤說明
100Invalid parameter
80008There have been too many calls to this WhatsApp Business account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
104Incorrect signature

建立中

You can make a POST request to message_templates edge from the following paths:
發佈到此關係連線時,會建立 a WhatsAppMessageTemplate

參數

參數說明
allow_category_change
boolean

Set to true to allow us to assign a category based on our template guidelines and the template's contents. This can prevent the template status from immediately being set to REJECTED upon creation due to miscategorization.


If omitted, template will not be auto-assigned a category and its status may be set to REJECTED if determined to be miscategorized.


See Template Categories.

category
enum {UTILITY, MARKETING, AUTHENTICATION}

Template category. See Template Categories.

必填
components
array<JSON object>

Array of components that make up the template. See Template Components.


For types HEADER, BODY, FOOTER, text is required.

type
enum {GREETING, HEADER, BODY, FOOTER, BUTTONS, CAROUSEL, LIMITED_TIME_OFFER}

Component type.

必填
format
enum {TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION}

Component format.

text
string

Required for components with type HEADER,BODY, or FOOTER.


Component text.

buttons
array<JSON object>

Button components to be used in the template.

type
enum {QUICK_REPLY, URL, PHONE_NUMBER, OTP, MPM, CATALOG, FLOW, VOICE_CALL}

Button type.

必填
text
string

Button text.

url
URI

url

phone_number
phone number string

phone_number

example
array<string>

example

flow_id
int64

flow_id

zero_tap_terms_accepted
boolean

zero_tap_terms_accepted

example
JSON object

Placeholder examples. Templates will not be approved without examples.

header_text
array<string>

header_text

body_text
array<array<string>>

body_text

header_handle
array<string>

header_handle

language
string

必填
message_send_ttl_seconds
int64

Time to live for message template sent. If users are offline for more than TTL duration after message template is sent, message will be dropped from message queue and will not be delivered.

Only allowed for authentication message templates.

name
string

Template name.

必填
sub_category
enum {ORDER_DETAILS, ORDER_STATUS}

Sub category of the template

傳回類型

此端點支援寫入後讀取功能,並將讀取你傳送 POST 的節點。
Struct {
id: numeric string,
status: enum,
category: enum,
}

Error Codes

錯誤說明
80008There have been too many calls to this WhatsApp Business account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting.
100Invalid parameter
192Invalid phone number
200002HSM Template creation failed
131009Parameter value is not valid
200Permissions error
368The action attempted has been deemed abusive or is otherwise disallowed
190Invalid OAuth 2.0 Access Token
139000Blocked by Integrity

更新中

你可以向 /{whats_app_message_template_id} 提出發佈要求,以更新 a WhatsAppMessageTemplate

參數

參數說明
category
enum {UTILITY, MARKETING, AUTHENTICATION}

category

components
array<JSON object>

The array containing all the content of the message template

type
enum {GREETING, HEADER, BODY, FOOTER, BUTTONS, CAROUSEL, LIMITED_TIME_OFFER}

Component type.

必填
format
enum {TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION}

Component format.

text
string

Required for components with type HEADER,BODY, or FOOTER.


Component text.

buttons
array<JSON object>

Button components to be used in the template.

type
enum {QUICK_REPLY, URL, PHONE_NUMBER, OTP, MPM, CATALOG, FLOW, VOICE_CALL}

Button type.

必填
text
string

Button text.

url
URI

url

phone_number
phone number string

phone_number

flow_id
int64

flow_id

zero_tap_terms_accepted
boolean

zero_tap_terms_accepted

message_send_ttl_seconds
int64

Template message delivery retry time-to-live (TTL) override value. If unable to deliver the template message to the WhatsApp user, we will periodically retry for this period of time. If we are unable to deliver the message for this period of time, the message will be dropped.

Only allowed for authentication message templates. See Time-To-Live.

傳回類型

此端點支援寫入後讀取功能,並將讀取你傳送 POST 的節點。
Struct {
success: bool,
}

Error Codes

錯誤說明
100Invalid parameter
192Invalid phone number
368The action attempted has been deemed abusive or is otherwise disallowed
131009Parameter value is not valid

刪除中

你可以向 /{whats_app_business_account_id}/message_templates 提出刪除要求,中斷 a WhatsAppMessageTemplate 和 a WhatsAppBusinessAccount 的關聯。

參數

參數說明
hsm_id
whatsapp business hsm ID

ID of template to be deleted. Required if deleting a template by ID.

name
string

Name of template to be deleted.

必填

傳回類型

Struct {
success: bool,
}

Error Codes

錯誤說明
100Invalid parameter
190Invalid OAuth 2.0 Access Token