Graph API Version

Whats App Business Account Message Templates

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

To find the ID of a WhatsApp Business Account (WABA), go to Business Manager > Business Settings > Accounts > WhatsApp Business Accounts. Find the WABA you want to use and click on it. A panel opens, with information about the account, including the ID.

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

Reading

Returns a list of message templates owned by a WhatsApp Business Account

Example

Requirements

  • whatsapp_business_management permission

  • whatsapp_business_messaging permission

  • public_profile permission

  • WhatsApp Business Account (WABA) ID

  • A user access token

Sample Request

Formatted for readability.

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

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

Sample Response

{
"data": [
    {
      "name": "hello_world",
      "components": [
        {
          "type": "HEADER",
          "format": "TEXT",
          "text": "Hello World"
        },
        {
          "type": "BODY",
          "text": "Welcome and congratulations!! This message demonstrates your ability to send a message notification from WhatsApp Business Platform’s Cloud API. Thank you for taking the time to test with us."
        },
        {
          "type": "FOOTER",
          "text": "WhatsApp Business API Team"
        },       
        
      ],
      "language": "en_US",
      "status": "APPROVED",
      "category": "TRANSACTIONAL",
      "id": "307191531401674"
    },
   {
      "name": "sample_flight_confirmation",
      "components": [
        {
          "type": "HEADER",
          "format": "DOCUMENT"
        },
        {
          "type": "BODY",
          "text": "This is your flight confirmation for {{1}}-{{2}} on {{3}}."
        },
        {
          "type": "FOOTER",
          "text": "This message is from an unverified business."
        }
      ],
      "language": "en_US",
      "status": "APPROVED",
      "category": "TRANSACTIONAL",
      "id": "697474831429277"
    }  
        
  ],
  "paging": {
    "cursors": {
      "before": "MAZDZD",
      "after": "MjQZD"
    }
  }
}

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, TRANSACTIONAL, MARKETING, OTP}>

The category for a template

content
string

The content for a template

language
array<string>

A list of supported languages that are available for each template

name
string

The name for a message template

name_or_content
string

Returns a list of message templates where the value for name or content match this value

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

The review status for a 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

The total number of message templates that belong to a WhatsApp Business Account

message_template_count
int32

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

message_template_limit
int32

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

are_translations_complete
bool

The status for template translations

Error Codes

ErrorDescription
200Permissions error
100Invalid parameter

Creating

Example

Requirements

  • whatsapp_business_management permission

  • whatsapp_business_messaging permission

  • public_profile permission

  • WhatsApp Business Account (WABA) ID

  • A user access token

Sample Request

Formatted for readability.

curl -i -X POST \
"https://graph.facebook.com/LATEST-VERSION/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates?
name=shiptest&
category=TRANSACTIONAL&
components=typeBODYtexttesting&
language=en_US&
access_token=USER-ACCESS-TOKEN"
GraphRequest request = GraphRequest.newPostRequest(
  accessToken,
  "/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates/",
  new JSONObject("{\"category\":\"TRANSACTIONAL\",\"components\":\"[\\n  {\\n    \\\"type\\\": \\\"BODY\\\",\\n    \\\"text\\\": \\\"testing\\\"\\n  }\\n]\",\"language\":\"en_US\",\"name\":\"shiptest\"}"),
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates/"
           parameters:@{ @"category": @"TRANSACTIONAL",@"components": @"[
  {
    "type": "BODY",
    "text": "testing"
  }
]",@"language": @"en_US",@"name": @"shiptest",}
           HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];

Sample Response

{
  "id": "POST-ID"
}
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 {TRANSACTIONAL, MARKETING, OTP}

The category for a template

Required
components
array<JSON object>

The components for the content for a template

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

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

example
array<string>

example

example
JSON object

example

header_text
array<string>

header_text

body_text
array<array<string>>

body_text

header_url
array<URI>

header_url

header_handle
array<string>

header_handle

language
string

The language (and locale) of the content

Required
name
string

The name for a 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
200002HSM Template creation failed
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.
192Invalid phone number
200Permissions error

Updating

You can't perform this operation on this endpoint.

Deleting

Example

Requirements

  • whatsapp_business_management permission

  • whatsapp_business_messaging permission

  • public_profile permission

  • WhatsApp Business Account (WABA) ID

  • A user access token

Sample Request

Formatted for readability.

curl -i -X DELETE \
 "https://graph.facebook.com/LATEST-VERSION/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates?name=shiptest&access_token=USER-ACCESS-TOKEN"
Bundle parameters = new Bundle();
parameters.putString("name", "shiptest");
GraphRequest request = new GraphRequest(
  accessToken,
  "/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates",
  parameters,
  HttpMethod.DELETE,
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/WHATSAPP-BUSINESS-ACCOUNT-ID/message_templates"
           parameters:@{ @"name": @"shiptest",}
           HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];

Sample Response

{
  "success": true
}
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

The name for the message template

Required

Return Type

Struct {
success: bool,
}

Error Codes

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