Facebook
Graph API Reference v20.0: Whats App Message Template - Documentation - Meta for Developers
Graph API Version

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/ v20.0 /{whatsapp-business-account-ID}/message_templates .

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

Reading

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"
}

Parameters

This endpoint doesn't have any parameters.

Fields

Field Description
id
numeric string

ID

category
enum

The category type of the message template

components

An array of JSON objects describing the message template components.

correct_category
enum

The correct category for the template.

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

Edges

Edge Description
Edge<WhatsAppBusinessHSMComparison>

compare

Error Codes

Error Description
100 Invalid parameter
80008 There 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.
104 Incorrect signature
2500 Error parsing graph query

Creating

You can make a POST request to message_templates edge from the following paths:
When posting to this edge, a  WhatsAppMessageTemplate will be created.

Parameters

Parameter Description
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 .

Required
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.

Required
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, APP}

Button type.

Required
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

flow_action
enum {NAVIGATE, DATA_EXCHANGE}

flow_action

navigate_screen
string

navigate_screen

supported_apps
array<JSON object>

supported_apps

package_name
string

package_name

Required
signature_hash
string

signature_hash

Required
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

Required
library_template_body_inputs
JSON object

Optional data during creation of a template from a library template. These are optional fields for the body component.

add_contact_number
boolean

add_contact_number

add_learn_more_link
boolean

add_learn_more_link

add_security_recommendation
boolean

add_security_recommendation

add_track_package_link
boolean

add_track_package_link

code_expiration_minutes
int64

code_expiration_minutes

library_template_button_inputs
array<JSON object>

Optional data during creation of a template from a library template. These are optional fields for the button component.

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

type

Required
phone_number
string

phone_number

url
JSON object

url

base_url
string

base_url

Required
url_suffix_example
string

url_suffix_example

otp_type
enum {COPY_CODE, ONE_TAP, ZERO_TAP}

otp_type

zero_tap_terms_accepted
boolean

zero_tap_terms_accepted

supported_apps
array<JSON object>

supported_apps

package_name
string

package_name

Required
signature_hash
string

signature_hash

Required
library_template_name
string

library_template_name

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.

Required
sub_category
enum {ORDER_DETAILS, ORDER_STATUS}

Sub category of the template

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
id : numeric string,
status : enum,
category : enum,
}

Error Codes

Error Description
100 Invalid parameter
192 Invalid phone number
80008 There 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.
131009 Parameter value is not valid
368 The action attempted has been deemed abusive or is otherwise disallowed
200 Permissions error
190 Invalid OAuth 2.0 Access Token
139000 Blocked by Integrity

Updating

You can update a  WhatsAppMessageTemplate by making a POST request to /{whats_app_message_template_id} .

Parameters

Parameter Description
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.

Required
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, APP}

Button type.

Required
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

flow_action
enum {NAVIGATE, DATA_EXCHANGE}

flow_action

navigate_screen
string

navigate_screen

supported_apps
array<JSON object>

supported_apps

package_name
string

package_name

Required
signature_hash
string

signature_hash

Required
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 .

Return Type

This endpoint supports read-after-write and will read the node to which you POSTed.
Struct {
success : bool,
}

Error Codes

Error Description
100 Invalid parameter
192 Invalid phone number
131009 Parameter value is not valid
80008 There 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.
368 The action attempted has been deemed abusive or is otherwise disallowed

Deleting

You can dissociate a  WhatsAppMessageTemplate from a  WhatsAppBusinessAccount by making a DELETE request to /{whats_app_business_account_id}/message_templates .

Parameters

Parameter Description
hsm_id
numeric string

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

name
string

Name of template to be deleted.

Required

Return Type

Struct {
success : bool,
}

Error Codes

Error Description
100 Invalid parameter
190 Invalid OAuth 2.0 Access Token
Design a Mobile Website
View Site in Mobile | Classic
Share by: