Graph API Version

Whats App Business Account Message Templates

This page contains only the API reference. For more information on how to use the API, refer to the WhatsApp Business Management API documentation.

Reading

WhatsAppBusinessAccountMessageTemplates

Example

Graph API Explorer
GET /v3.3/{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();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* 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}>

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, PENDING, REJECTED, PENDING_DELETION, DELETED}>

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

are_translations_complete
bool

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

Creating

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

Create a message template

Parameters

ParameterDescription
id
whatsapp business account ID

id

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

Message template category

components
array<JSON object>

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

language
string

The language (and locale) of the content

name
string

Name of the message template

Return Type

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

Updating

Deleting

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

Deleting a message template in a WhatsApp Business Account

Parameters

ParameterDescription
id
whatsapp business account ID

WhatsApp Business Account ID

name
string

Message Template Name

Return Type

Struct {
success: bool,
}