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. See the Vonage Developer Portal for more information.

Baixar a especificação OpenAPI

WhatsApp Template Management

Create and Manage WhatsApp Message Templates

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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

Headers

Bearer <JWT>

Caminho Parâmetros

id
string
Obrigatório
exemplo345688589250625

The id of the WABA

Consulta Parâmetros

limit
number
Mín.1
Max500
Padrão25
exemplo10

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
exemploMAZDZD

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

after
string
exemploMjQZD

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

category
string
exemploUTILITY

A filter for returning only templates matching a specific category.

Deve ser uma das seguintes opções:UTILITYAUTHENTICATIONMARKETING
content
string
exemplospecial offer

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

language
string
exemploen

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

name
string
exemploMy 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
exemplospecial 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
exemploRED

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

Deve ser uma das seguintes opções:GREENYELLOWREDUNKNOWN
status
string
exemploAPPROVED

A filter for returning only templates matching a specific status.

Deve ser uma das seguintes opções:APPROVEDIN_APPEALPENDINGREJECTEDDISABLEDPAUSEDLIMIT_EXCEEDED

Respostas
Tipo de conteúdo
application/json

OK

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging
paging
object
cursors
object
before
string
exemploMAZDZD

The template before the first template in the current list

after
string
exemploMjQZD

The template after the last template in the current list

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

A URI to ge the next paginated page.

previous
string(uri)
exemplohttps://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
exemplo1045638762820500

The unique identifier for this template.

status
string
exemploAPPROVED

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

Deve ser uma das seguintes opções:APPROVEDREJECTEDIN_APPEALPENDINGPENDING_DELETIONDELETEDDISABLEDLOCKED
previous_category
string
exemploMARKETING

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

name
string
Obrigatório
exemplosample_issue_resolution

The name of the template

language
string
Obrigatório
exemploen

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
Obrigatório
exemploUTILITY

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

Deve ser uma das seguintes opções:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
exemplotrue

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.

Deve ser uma das seguintes opções:truefalse
components
array
Obrigatório

An array of objects representing the parts of the template itself. A template must have at least one component, and at least one component must be of type BODY. HEADER, FOOTER, and BUTTONS components are optional.

Qualquer um dos
Um dos
Um dos
type
string
exemploHEADER

The type of template component.

Deve ser uma das seguintes opções:HEADER
format
string
exemploTEXT

The format of the template component. For a Text Header, format is always TEXT.

Deve ser uma das seguintes opções:TEXT
text
string
Max60
exemploYour parcel is out for delivery.

The text to be displayed in this template component. Maximum 60 characters.

Exemplo Resposta

{
   "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",
         "status": "APPROVED",
         "previous_category": "MARKETING",
         "name": "sample_issue_resolution",
         "language": "en",
         "category": "UTILITY",
         "allow_category_change": true,
         "components": [
            {
               "type": "BODY",
               "text": "Your parcel will be delivered today"
            }
         ]
      }
   ]
}

Create Template

Submit a new template to be associated with this WABA

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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

Headers

Bearer <JWT>

Caminho Parâmetros

id
string
Obrigatório
exemplo345688589250625

The id of the WABA

Cabeçalho Parâmetros

Content-Type
string

application/json

Corpo da solicitação
Tipo de conteúdo
application/json

name
string
Obrigatório
exemplosample_issue_resolution

The name of the template

language
string
Obrigatório
exemploen

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
Obrigatório
exemploUTILITY

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

Deve ser uma das seguintes opções:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
exemplotrue

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.

Deve ser uma das seguintes opções:truefalse
components
array
Obrigatório

An array of objects representing the parts of the template itself. A template must have at least one component, and at least one component must be of type BODY. HEADER, FOOTER, and BUTTONS components are optional.

Qualquer um dos
Um dos
Um dos
type
string
exemploHEADER

The type of template component.

Deve ser uma das seguintes opções:HEADER
format
string
exemploTEXT

The format of the template component. For a Text Header, format is always TEXT.

Deve ser uma das seguintes opções:TEXT
text
string
Max60
exemploYour parcel is out for delivery.

The text to be displayed in this template component. Maximum 60 characters.

Exemplo Solicitação

{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "text": "Your parcel will be delivered today"
      }
   ]
}
{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "components": [
      {
         "type": "BODY",
         "text": "Your parcel will be delivered today"
      }
   ]
}

Respostas
Tipo de conteúdo
application/json

OK

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging
id
string
Obrigatório
exemplo408766354711449

The unique ID of the created template.

Exemplo Resposta

{
   "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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

Headers

Bearer <JWT>

Caminho Parâmetros

id
string
Obrigatório
exemplo345688589250625

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.

Respostas

No Content - Resource successfully deleted

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging

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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

Headers

Bearer <JWT>

Caminho Parâmetros

id
string
Obrigatório
exemplo345688589250625

The id of the WABA

template_id
string
Obrigatório
exemplo1045638762820500

The id of the template

Respostas
Tipo de conteúdo
application/json

OK

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging
id
string
exemplo1045638762820500

The unique identifier for this template.

status
string
exemploAPPROVED

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

Deve ser uma das seguintes opções:APPROVEDREJECTEDIN_APPEALPENDINGPENDING_DELETIONDELETEDDISABLEDLOCKED
previous_category
string
exemploMARKETING

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

name
string
Obrigatório
exemplosample_issue_resolution

The name of the template

language
string
Obrigatório
exemploen

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
Obrigatório
exemploUTILITY

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

Deve ser uma das seguintes opções:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
exemplotrue

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.

Deve ser uma das seguintes opções:truefalse
components
array
Obrigatório

An array of objects representing the parts of the template itself. A template must have at least one component, and at least one component must be of type BODY. HEADER, FOOTER, and BUTTONS components are optional.

Qualquer um dos
Um dos
Um dos
type
string
exemploHEADER

The type of template component.

Deve ser uma das seguintes opções:HEADER
format
string
exemploTEXT

The format of the template component. For a Text Header, format is always TEXT.

Deve ser uma das seguintes opções:TEXT
text
string
Max60
exemploYour parcel is out for delivery.

The text to be displayed in this template component. Maximum 60 characters.

Exemplo Resposta

{
   "id": "1045638762820500",
   "status": "APPROVED",
   "previous_category": "MARKETING",
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "text": "Your parcel will be delivered today"
      }
   ]
}

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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

Headers

Bearer <JWT>

Caminho Parâmetros

id
string
Obrigatório
exemplo345688589250625

The id of the WABA

template_id
string
Obrigatório
exemplo1045638762820500

The id of the template

Cabeçalho Parâmetros

Content-Type
string

application/json

Corpo da solicitação
Tipo de conteúdo
application/json

name
string
Obrigatório
exemplosample_issue_resolution

The name of the template

language
string
Obrigatório
exemploen

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
Obrigatório
exemploUTILITY

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

Deve ser uma das seguintes opções:UTILITYAUTHENTICATIONMARKETING
allow_category_change
boolean
exemplotrue

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.

Deve ser uma das seguintes opções:truefalse
components
array
Obrigatório

An array of objects representing the parts of the template itself. A template must have at least one component, and at least one component must be of type BODY. HEADER, FOOTER, and BUTTONS components are optional.

Qualquer um dos
Um dos
Um dos
type
string
exemploHEADER

The type of template component.

Deve ser uma das seguintes opções:HEADER
format
string
exemploTEXT

The format of the template component. For a Text Header, format is always TEXT.

Deve ser uma das seguintes opções:TEXT
text
string
Max60
exemploYour parcel is out for delivery.

The text to be displayed in this template component. Maximum 60 characters.

Exemplo Solicitação

{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "allow_category_change": true,
   "components": [
      {
         "type": "BODY",
         "text": "Your parcel will be delivered today"
      }
   ]
}
{
   "name": "sample_issue_resolution",
   "language": "en",
   "category": "UTILITY",
   "components": [
      {
         "type": "BODY",
         "text": "Your parcel will be delivered today"
      }
   ]
}

Respostas

No Content - Resource successfully deleted

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging

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

Autenticação

ChaveDescriçãoOndeExemplo
Authorization

Seu token JSON da Web.
Saiba mais sobre os JWTs

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.

Cabeçalho Parâmetros

Content-Type
string

multipart/form-data

Corpo da solicitação
Tipo de conteúdo
multipart/form-data

mediafile
string(binary)
exemplo--73dc24e0-b350-48f8-931e-eab338df00e1--

The file to be uploaded. See an example cURL request

Exemplo Solicitação

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

mediafile=--73dc24e0-b350-48f8-931e-eab338df00e1--
POST /v2/whatsapp-manager/media/uploads HTTP/1.1
Host: api.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 0

Respostas
Tipo de conteúdo
application/json

OK

Cabeçalho Parâmetros
X-Request-Id
string(uuid)
exemplof94b4e56-604e-07e5-e5ad-5a7228618f81
A unique identifier for the request, used for tracking and debugging
h
string
exemplo:c2FtcGxlLm1wNA==:image/jpeg:GKAj0gAUCZmJ1voFADip2iIAAAAAbugbAAAA:e:1472075513:ARZ_3ybzrQqEaluMUdI

The uploaded file's file handle. Media handles are valid for 30 days after the upload time, and can be used in template components for template creation.

Exemplo Resposta

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

Erros

A seguir, apresentamos uma lista não exaustiva de códigos de erro que podem ocorrer durante o uso desta API.

Esses códigos são adicionais aos que constam em nosso site códigos de erro genéricos.

CódigoInformações
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.