This page contains only the API reference. For more information on how to use the API, refer to the WhatsApp Business Management API documentation.
Queries message templates of a WhatsApp Business Account
GET /v10.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();
// 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
}];
Parameter | Description |
---|---|
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 |
Reading from this edge will return a JSON formatted result:
{ "
data
": [], "paging
": {}, "summary
": {} }
data
paging
summary
Aggregated information about the edge, such as counts. Specify the fields to fetch in the summary param (like summary=total_count
).
Field | Description |
---|---|
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 |
Error | Description |
---|---|
100 | Invalid parameter |
200 | Permissions error |
message_templates
edge from the following paths: Parameter | Description |
---|---|
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 |
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 |
id
: numeric string, Error | Description |
---|---|
100 | Invalid parameter |
200 | Permissions error |
192 | Invalid phone number |
/{whats_app_business_account_id}/message_templates
.Parameter | Description |
---|---|
name string | Message Template Name Required |
success
: bool, Error | Description |
---|---|
100 | Invalid parameter |