WhatsApp Template Management API

The Messages API now offers the WhatsApp Template Management API that allow you to manage templates for your WABAs and cut out the manual step of submitting and checking templates manually. You can manage your templates using the Template Management API, including adding new templates, retrieving their statuses, and deleting any that are already in use. Different sorts of media can be sent with each WhatsApp message template. You can manage your media files via the API and set up extra features to improve their functionality.

Descargar la especificación OpenAPI

List Templates

Get a list of templates,and their associated metadata, for the specified WABA ID. If multiple language variants exist for a template, each variant will be returned as a separate template object.

gethttps://api.nexmo.com/v2/whatsapp-manager/wabas/:id/templates

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Ruta Parámetros

id
string
Requerido

The id of the WABA

Consulta Parámetros

limit
number
Min1
Max500
Por defecto25
ejemplo10

The number of templates to return in the list. Although the max size is 500, for large datasets it is recommended to use a lower limit and instead use pagination to avoid potential timeouts.

before
string
ejemploMAZDZD

A cursor point used for a paginated request to indicate the template to paginate backwards from.

after
string
ejemploMjQZD

A cursor point used for a paginated request to indicate the template to paginate forwards from.

category
string
ejemploUTILITY

A filter for returning only templates matching a specific category.

Debe ser uno de:UTILITYAUTHENTICATIONMARKETING
content
string
ejemplospecial offer

A search filter representing the content of a template. Only matching templates will be returned in the list.

language
string
ejemploen

A filter for returning only templates matching a specific language code. A list of supported languages is available in the WhatsApp documentation

name
string
ejemploMy Template

A search filter representing the name, either full or partial, of a template. Only matching templates will be returned in the list.

name_or_content
string
ejemplospecial offer

A search filter representing the name, either full or partial, or content of a template. Only matching templates will be returned in the list.

quality_score
string
ejemploRED

A search filter representing the quality score of a template. Only matching templates will be returned in the list.

Debe ser uno de:GREENYELLOWREDUNKNOWN
status
string
ejemploAPPROVED

A filter for returning only templates matching a specific status.

Debe ser uno de:APPROVEDIN_APPEALPENDINGREJECTEDDISABLEDPAUSEDLIMIT_EXCEEDED

Respuestas
Tipo de contenido
application/json

OK

paging
object
cursors
object
before
string
ejemploMAZDZD

The template before the first template in the current list

after
string
ejemploMjQZD

The template after the last template in the current list

next
string(uri)
ejemplohttps://api.nexmo.com/v2/whatsapp-manager/wabas/106499765517625/templates?after=MwZDZD

A URI to ge the next paginated page.

previous
string(uri)
ejemplohttps://api.nexmo.com/v2/whatsapp-manager/wabas/106499765517625/templates?before=MgZDZD

A URI to ge the previous paginated page.

templates
array

An array of templates in the current list

id
string
ejemplo1045638762820500

The unique identifier for this template.

name
string
ejemplosample_issue_resolution

The name of the template

language
string
ejemploen

The language of the template. The same template name can be used for multiple language versions. A list of supported languages is available in the WhatsApp documentation

status
string
ejemploAPPROVED

The status of the template. Templates with a status of APPROVED can be used in WhatsApp template messages.

Debe ser uno de:APPROVEDREJECTEDIN_APPEALPENDINGPENDING_DELETIONDELETEDDISABLEDLOCKED
category
string
ejemploUTILITY

The category of the template. This determines the purpose of the template. Note: until June 1st 2023 some older template categories may be listed. These should be updated to one the valid categories or they will be automatically migrated.

Debe ser uno de:UTILITYAUTHENTICATIONMARKETING
previous_category
string
ejemploMARKETING

If the template has been updated to a different category, shows the previous category of the template.

components
array

An array of objects representing the parts of the template itself.

Cualquiera de
type
string
ejemploBODY

The type of template component.

Debe ser uno de:HEADERBODYFOOTER
format
string
ejemploTEXT

The format of the template component. Where type is HEADER can be TEXT, IMAGE, DOCUMENT, or VIDEO. Where type is BODY or FOOTER, must be TEXT.

text
string
ejemploYour parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.

The text to be displayed in this template component. EIther plain text or text with placeholders 1.

Ejemplo Respuesta

{
   "paging": {
      "cursors": {
         "before": "MAZDZD",
         "after": "MjQZD"
      },
      "next": "https://api.nexmo.com/v2/whatsapp-manager/wabas/106499765517625/templates?after=MwZDZD",
      "previous": "https://api.nexmo.com/v2/whatsapp-manager/wabas/106499765517625/templates?before=MgZDZD"
   },
   "templates": [
      {
         "id": "1045638762820500",
         "name": "sample_issue_resolution",
         "language": "en",
         "status": "APPROVED",
         "category": "UTILITY",
         "previous_category": "MARKETING",
         "components": [
            {
               "type": "BODY",
               "format": "TEXT",
               "text": "Your parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}."
            }
         ]
      }
   ]
}

Create Template

Submit a new template to be associated with this WABA

posthttps://api.nexmo.com/v2/whatsapp-manager/wabas/:id/templates

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Ruta Parámetros

id
string
Requerido

The id of the WABA

Cabecera Parámetros

Content-Type
string

application/json

Cuerpo de la solicitud
Tipo de contenido
application/json

Uno de
name
string
Requerido
ejemplosample_issue_resolution

The name of the template

language
string
Requerido
ejemploen

The language of the template. The same template name can be used for multiple language versions. A list of supported languages is available in the WhatsApp documentation. Note: Adding new languages on legacy template categories has been disabled by Meta, see the documentation for Language Variants and Categories

category
string
Requerido
ejemploUTILITY

The required category of the template. The category determines what the template will be used for. Note: Adding new languages on legacy template categories has been disabled by Meta, see the documentation for Language Variants and Categories

Debe ser uno de:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
ejemplotrue

This field is now deprecated. This functionality is now enabled by default by Meta and cannot be disabled. See the Meta documentation for more infomration.

An optional parameter which, when set to true, can avoid template rejection due to mis-categorization. Including this parameter, with a value of true, will allow Meta to re-assign the template to a different category as appropriate.

Debe ser uno de:truefalse
components
array
Requerido

An array of objects representing the parts of the template itself.

type
string
ejemploBODY

The type of template component. HEADER, FOOTER, and BUTTONS are optional, a BODY is always a required component of a template.

Debe ser uno de:HEADERBODYFOOTERBUTTONS
format
string
ejemploTEXT

The format of the template component. For a Text Template, format is always TEXT for HEADER, BODY or FOOTER components.

Debe ser uno de:TEXT
text
string
ejemploYour parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.

The text to be displayed in this template component. EIther plain text or text with placeholders 1.

example
object

Must be included when placeholders are used in the text.

body_text
array

An array containing one array. The inner array contains strings, with one item for each placeholder used in the text. Must be included when format is text and placeholders are included in the text.

buttons
array

Where type is set to BUTTONS, an array of button objects representing the properties of each button.

type
string
ejemploQUICK_REPLY

The type of button.

Debe ser uno de:QUICK_REPLYURLPHONE_NUMBER
text
string
ejemploYes

The text to appear on the button.

url
string(uri)
ejemplohttps://example.com/special-offer-opt-in

A URL to which the end-user will be directed when hitting the button. Must be set when type is URL.

phone_number
string
ejemplo8001111111

Phone number to which a phone call would be placed by the end-user when hitting the button. Must be set when type is PHONE_NUMBER.

Ejemplo Solicitar

{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "format": "TEXT",
         "text": "Your parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.",
         "example": {
            "body_text": "[['Courier','May 1st', '3:00PM', '4:00PM']]"
         },
         "buttons": [
            {
               "type": "QUICK_REPLY",
               "text": "Yes",
               "url": "https://example.com/special-offer-opt-in",
               "phone_number": "8001111111"
            }
         ]
      }
   ]
}

Respuestas
Tipo de contenido
application/json

OK

id
string
Requerido
ejemplo408766354711449

The unique ID of the created template.

Ejemplo Respuesta

{
   "id": "408766354711449"
}

Delete Template

Delete a template of the specified name associated with the WABA ID

deletehttps://api.nexmo.com/v2/whatsapp-manager/wabas/:id/templates

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Ruta Parámetros

id
string
Requerido

The id of the WABA

Consulta Parámetros

name
string

The name of the template to be deleted. The name is required, but if specified without hsm_id being specified then all templates matching that name will be deleted.

hsm_id
string

The ID of the specific template to be deleted. Only the template matching both the specified name and hsm_id will be deleted.

Respuestas

No Content

Get Template

Get details of an existing template identified by the WABA and Template ID

gethttps://api.nexmo.com/v2/whatsapp-manager/wabas/:id/templates/:template_id

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Ruta Parámetros

id
string
Requerido

The id of the WABA

template_id
string
Requerido

The id of the template

Respuestas
Tipo de contenido
application/json

OK

id
string
ejemplo1045638762820500

The unique identifier for this template.

name
string
ejemplosample_issue_resolution

The name of the template

language
string
ejemploen

The language of the template. The same template name can be used for multiple language versions. A list of supported languages is available in the WhatsApp documentation

status
string
ejemploAPPROVED

The status of the template. Templates with a status of APPROVED can be used in WhatsApp template messages.

Debe ser uno de:APPROVEDREJECTEDIN_APPEALPENDINGPENDING_DELETIONDELETEDDISABLEDLOCKED
category
string
ejemploUTILITY

The category of the template. This determines the purpose of the template. Note: until June 1st 2023 some older template categories may be listed. These should be updated to one the valid categories or they will be automatically migrated.

Debe ser uno de:UTILITYAUTHENTICATIONMARKETING
previous_category
string
ejemploMARKETING

If the template has been updated to a different category, shows the previous category of the template.

components
array

An array of objects representing the parts of the template itself.

Cualquiera de
type
string
ejemploBODY

The type of template component.

Debe ser uno de:HEADERBODYFOOTER
format
string
ejemploTEXT

The format of the template component. Where type is HEADER can be TEXT, IMAGE, DOCUMENT, or VIDEO. Where type is BODY or FOOTER, must be TEXT.

text
string
ejemploYour parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.

The text to be displayed in this template component. EIther plain text or text with placeholders 1.

Ejemplo Respuesta

{
   "id": "1045638762820500",
   "name": "sample_issue_resolution",
   "language": "en",
   "status": "APPROVED",
   "category": "UTILITY",
   "previous_category": "MARKETING",
   "components": [
      {
         "type": "BODY",
         "format": "TEXT",
         "text": "Your parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}."
      }
   ]
}

Update Template

Update an existing template identified by the WABA and Template ID

puthttps://api.nexmo.com/v2/whatsapp-manager/wabas/:id/templates/:template_id

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Cabecera Parámetros

Content-Type
string

application/json

Ruta Parámetros

id
string
Requerido

The id of the WABA

template_id
string
Requerido

The id of the template to be updated

Cuerpo de la solicitud
Tipo de contenido
application/json

Uno de
name
string
Requerido
ejemplosample_issue_resolution

The name of the template

language
string
Requerido
ejemploen

The language of the template. The same template name can be used for multiple language versions. A list of supported languages is available in the WhatsApp documentation. Note: Adding new languages on legacy template categories has been disabled by Meta, see the documentation for Language Variants and Categories

category
string
Requerido
ejemploUTILITY

The required category of the template. The category determines what the template will be used for. Note: Adding new languages on legacy template categories has been disabled by Meta, see the documentation for Language Variants and Categories

Debe ser uno de:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
ejemplotrue

This field is now deprecated. This functionality is now enabled by default by Meta and cannot be disabled. See the Meta documentation for more infomration.

An optional parameter which, when set to true, can avoid template rejection due to mis-categorization. Including this parameter, with a value of true, will allow Meta to re-assign the template to a different category as appropriate.

Debe ser uno de:truefalse
components
array
Requerido

An array of objects representing the parts of the template itself.

type
string
ejemploBODY

The type of template component. HEADER, FOOTER, and BUTTONS are optional, a BODY is always a required component of a template.

Debe ser uno de:HEADERBODYFOOTERBUTTONS
format
string
ejemploTEXT

The format of the template component. For a Text Template, format is always TEXT for HEADER, BODY or FOOTER components.

Debe ser uno de:TEXT
text
string
ejemploYour parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.

The text to be displayed in this template component. EIther plain text or text with placeholders 1.

example
object

Must be included when placeholders are used in the text.

body_text
array

An array containing one array. The inner array contains strings, with one item for each placeholder used in the text. Must be included when format is text and placeholders are included in the text.

buttons
array

Where type is set to BUTTONS, an array of button objects representing the properties of each button.

type
string
ejemploQUICK_REPLY

The type of button.

Debe ser uno de:QUICK_REPLYURLPHONE_NUMBER
text
string
ejemploYes

The text to appear on the button.

url
string(uri)
ejemplohttps://example.com/special-offer-opt-in

A URL to which the end-user will be directed when hitting the button. Must be set when type is URL.

phone_number
string
ejemplo8001111111

Phone number to which a phone call would be placed by the end-user when hitting the button. Must be set when type is PHONE_NUMBER.

Ejemplo Solicitar

{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "format": "TEXT",
         "text": "Your parcel from {{1}} is due to arrive on {{2}} between {{3}} and {{4}}.",
         "example": {
            "body_text": "[['Courier','May 1st', '3:00PM', '4:00PM']]"
         },
         "buttons": [
            {
               "type": "QUICK_REPLY",
               "text": "Yes",
               "url": "https://example.com/special-offer-opt-in",
               "phone_number": "8001111111"
            }
         ]
      }
   ]
}

Respuestas

No Content

Media Upload

Upload media files to the WhatsApp platform. Once uploaded, you can use an uploaded file's handle to create a media template.

posthttps://api.nexmo.com/v2/whatsapp-manager/media/uploads

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Su token web JSON.
Más información sobre los JWT

Headers

Bearer <JWT>

Consulta Parámetros

file_type
string

The file's MIME type. Valid values are: image/jpeg, image/jpg, image/png, and video/mp4.

Cabecera Parámetros

Content-Type
string

multipart/form-data

Cuerpo de la solicitud
Tipo de contenido
multipart/form-data

mediafile
string(binary)

The file to be uploaded. See an example cURL request

Ejemplo Solicitar

POST /v2/whatsapp-manager/media/uploads HTTP/1.1
Host: api.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 16

mediafile=string

Respuestas
Tipo de contenido
application/json

OK

h
string
ejemplo:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI

The uploaded file's file handle

Ejemplo Respuesta

{
   "h": ":c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI"
}

Errores

La siguiente es una lista no exhaustiva de códigos de error que pueden producirse al utilizar esta API.

Estos códigos se suman a cualquiera de nuestros códigos de error genéricos.

CódigoInformación
1000

Throttled - You have exceeded the submission capacity allowed on this account. Please wait and retry

1030

Internal error - There was an error processing your request in the Platform.