Get and delete templates
Last update: 6 hours ago by Irais Aguirre
Get templates, get a template by ID, and delete a template.
Integration summary
- Base URL:
https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services- Token: admin token, in the
Authorization: Bearer {{admin-token}}header (how to generate it)- Endpoints on this page:
GET /v1/template/{{waba_id}}: Get templatesGET /v1/template/{{waba_id}}/{{template_id}}: Get template by IDDELETE /v1/template/{{waba_id}}?template_name={{template_name}}: Delete template
Get templates
Request
Get templates request:
| URL | https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}} |
| Method | GET |
| Type | application/json |
Headers
Get templates headers:
| Name | Description | Type | Requirements |
|---|---|---|---|
| Authorization | Admin token. See Generate authentication token. | String | Required |
Parameters
Get templates parameters:
| Name | Description | Type | Requirements |
|---|---|---|---|
| waba_id | WhatsApp Business Account (WABA) ID. It must be the WABA linked to your token. Digits only. | String | Required |
Example
Complete Get templates example:
curl "https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}" \-H 'Authorization: Bearer {{admin-token}}'
Response
Get templates response:
| Name | Description | Type |
|---|---|---|
| id | Template ID. | String |
| name | Template name. | String |
| language | Template locale. Example: es_ES, es_MX, es_US. Supported languages: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/ | String |
| namespace | The namespace to use. If the namespace doesn't match element_name, the message isn't sent. | String |
| status | Current status of the template. For example:
| String |
| category | Template category:
| String |
| rejectedReason | Rejection reason. Only included if the template was rejected. | String |
| created | Creation date. | String |
| allowCategoryChange | Whether Meta can automatically assign the template category. | Boolean |
[{"id": "747393629111800","name": "aviso","language": "es_MX","status": "APPROVED","namespace": "2d5051d2_76fd_43e4_842f_2d5b215188fa","category": "UTILITY","created": "2021-11-23T16:18:49.285","allowCategoryChange": true},{"id": "142990321034346","name": "bienvenida","language": "es","status": "APPROVED","namespace": "2d5051d2_76fd_43e4_842f_2d5b215188fa","category": "MARKETING","created": "2021-11-23T16:18:49.285","allowCategoryChange": true}]
Get template by ID
Request
Get template by ID request:
| URL | https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}/{{template_id}} |
| Method | GET |
| Type | application/json |
Headers
Get template by ID headers:
| Name | Description | Type | Requirements |
|---|---|---|---|
| Authorization | Admin token. See Generate authentication token. | String | Required |
Parameters
Get template by ID parameters:
| Name | Description | Type | Requirements |
|---|---|---|---|
| waba_id | WhatsApp Business Account (WABA) ID. It must be the WABA linked to your token. | String | Required |
| template_id | Template ID. | String | Required |
Example
Complete Get template by ID example:
curl "https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}/{{template_id}}" \-H 'Authorization: Bearer {{admin-token}}'
Response
Get template by ID response:
Note: if the template or its WABA information isn't found, the service responds with HTTP 204 and an empty body.
| Name | Description | Type |
|---|---|---|
| id | Template ID. | String |
| name | Template name. | String |
| language | Template language and locale code. | String |
| status | Template status. | String |
| category | Template category. | String |
| structure | Template structure: header, body, footer, and buttons. | Structure object |
| allowCategoryChange | Whether Meta can automatically assign the template category. | Boolean |
{"id": "642673911170541","name": "ejemplo_template","language": "es","status": "APPROVED","category": "MARKETING","structure":{"body":{"text": "Happy holidays, {{1}}! Wishing you joy and happiness with your loved ones.","example":{"body_text":[["Customer"]]}}},"allowCategoryChange": true}
Delete template
Request
Delete template request:
| URL | https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}?template_name={{template_name}} |
| Method | DELETE |
| Type | application/json |
Headers
Delete template headers:
| Name | Description | Type | Requirements |
|---|---|---|---|
| Content-Type | application/json | String | Required |
| Authorization | Admin token. See Generate authentication token. | String | Required |
Parameters
Delete template parameters:
| Name | Description | Type | Requirements |
|---|---|---|---|
| waba_id | WhatsApp Business Account (WABA) ID. It must be the WABA linked to your token. Digits only. | String | Required |
| template_name | Template name, sent as a query parameter. All languages of the template with this name are deleted. | String | Required |
Example
Complete Delete template example:
curl -X DELETE "https://{{url}}/whatsapp-bsp-admin-ext-endpoint-ws/services/v1/template/{{waba_id}}?template_name={{template_name}}" \-H 'Content-Type: application/json' \-H 'Authorization: Bearer {{admin-token}}'
Response
Delete template response:
| Name | Description | Type |
|---|---|---|
| code | Status code. 0 means the template was deleted; 10 means it couldn't be deleted. | Integer |
| detail | Status detail of the response. | String |
{"code": 0,"detail": "Success"}
Get template status
To get the status and quality of your WABA's templates (the template-status endpoint), see Get template quality in the Quality monitoring section.
