Graph API Version

WhatsApp Message Template

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

Retrieves information about the message template

Example

Graph API Explorer
GET v6.0/...?fields={fieldname_of_type_WhatsAppMessageTemplate} 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(
    '...?fields={fieldname_of_type_WhatsAppMessageTemplate}',
    '{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(
    "...?fields={fieldname_of_type_WhatsAppMessageTemplate}",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "...?fields={fieldname_of_type_WhatsAppMessageTemplate}",
    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:@"...?fields={fieldname_of_type_WhatsAppMessageTemplate}"
                                      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

This endpoint doesn't have any parameters.

Fields

FieldDescription
id
numeric string

ID

category
enum

The category type of the message template

components
list<WhatsAppBusinessHSMWhatsAppHSMComponentGet>

The array containing all the content of the message template

language
string

The language (and locale) of the element translation

last_updated_time
datetime

The timestamp indicating the last time the message template was updated

name
string

The message template name

rejected_reason
enum

The reason the message template was rejected

status
enum

The status of the message template

Validation Rules

ErrorDescription
100Invalid parameter

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

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

Validation Rules

ErrorDescription
100Invalid parameter
200Permissions error

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

Validation Rules

ErrorDescription
100Invalid parameter