Graph API Version

Whats App Business Account Message Templates

Represents message templates that belong to a specific WhatsApp Business Account (WABA).

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

Reading

Queries message templates of a WhatsApp Business Account

Example

Graph API Explorer
GET /v11.0/{whats-app-business-account-id}/message_templates HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/{whats-app-business-account-id}/message_templates',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/{whats-app-business-account-id}/message_templates",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{whats-app-business-account-id}/message_templates",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{whats-app-business-account-id}/message_templates"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
If you want to learn how to use the Graph API, read our Using Graph API guide.

Parameters

ParameterDescription
category
array<enum {ACCOUNT_UPDATE, PAYMENT_UPDATE, PERSONAL_FINANCE_UPDATE, SHIPPING_UPDATE, RESERVATION_UPDATE, ISSUE_RESOLUTION, APPOINTMENT_UPDATE, TRANSPORTATION_UPDATE, TICKET_UPDATE, ALERT_UPDATE, AUTO_REPLY}>

Message template category

content
string

Message template string with placeholders for parameters

language
array<string>

The language (and locale) of the content

name
string

Name of the message template

name_or_content
string

String as a query parameter to filter message templates name or content containing this variable

status
array<enum {APPROVED, IN_APPEAL, PENDING, REJECTED, PENDING_DELETION, DELETED, DISABLED}>

Status of the message template

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {}, "summary": {} }

data

A list of WhatsAppBusinessHSM nodes.

paging

For more details about pagination, see the Graph API guide.

summary

Aggregated information about the edge, such as counts. Specify the fields to fetch in the summary param (like summary=total_count).

FieldDescription
total_count
unsigned int32

Total number of message templates

message_template_count
int32

The current number of message templates belonging to the WhatsApp Business Account

message_template_limit
int32

The maximum number of message templates that can belong to the WhatsApp Business Account

are_translations_complete
bool

Is this message template translated in every language in the WhatsApp business account

Error Codes

ErrorDescription
100Invalid parameter
200Permissions error

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

ParameterDescription
category
enum {ACCOUNT_UPDATE, PAYMENT_UPDATE, PERSONAL_FINANCE_UPDATE, SHIPPING_UPDATE, RESERVATION_UPDATE, ISSUE_RESOLUTION, APPOINTMENT_UPDATE, TRANSPORTATION_UPDATE, TICKET_UPDATE, ALERT_UPDATE, AUTO_REPLY}

Message template category

Required
components
array<JSON object>

This is the new format for entering the content for the message template

Required
type
enum {HEADER, BODY, FOOTER, BUTTONS}

type

Required
format
enum {TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION}

format

text
string

text

buttons
array<JSON object>

buttons

type
enum {QUICK_REPLY, URL, PHONE_NUMBER}

type

Required
text
string

text

Required
url
URI

url

phone_number
phone number string

phone_number

language
string

The language (and locale) of the content

Required
name
string

Name of the message template

Required

Return Type

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

Error Codes

ErrorDescription
100Invalid parameter
192Invalid phone number
200Permissions error
200001HSM Template body url does not meet community standards

Updating

You can't perform this operation on this endpoint.

Deleting

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

Parameters

ParameterDescription
name
string

Message Template Name

Required

Return Type

Struct {
success: bool,
}

Error Codes

ErrorDescription
100Invalid parameter