> For the complete documentation index, see [llms.txt](https://docs.taqnyat.sa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taqnyat.sa/api-reference/send-templates-1.md).

# Send Templates

Send approved WhatsApp template messages.

## Send Failover Template Message

> Send a WhatsApp template message with SMS and/or Email failover.\
> \
> This operation is represented as GET because the supplied Taqnyat API\
> documentation explicitly uses \`--request GET\` for the failover template\
> request, even though it also includes a JSON request body.<br>

```json
{"openapi":"3.0.3","info":{"title":"Taqnyat WhatsApp API - Send Templates","version":"2.0"},"tags":[{"name":"Send Templates","description":"Send approved WhatsApp template messages."}],"servers":[{"url":"https://api.taqnyat.sa/wa/v2","description":"Taqnyat WhatsApp API"}],"security":[{"BearerApiToken":[]}],"components":{"securitySchemes":{"BearerApiToken":{"type":"http","scheme":"bearer","description":"Bearer authentication as shown in the supplied Catalog and Failover\nAPI documentation examples.\n"}},"schemas":{"TemplateObjectStatusResponse":{"type":"object","properties":{"type":{"type":"string"},"statuses":{"type":"object","properties":{"message_id":{"type":"string"},"recipient":{"type":"string"}}}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"reason":{"type":"string"}}}}},"paths":{"/messages/":{"get":{"tags":["Send Templates"],"summary":"Send Failover Template Message","description":"Send a WhatsApp template message with SMS and/or Email failover.\n\nThis operation is represented as GET because the supplied Taqnyat API\ndocumentation explicitly uses `--request GET` for the failover template\nrequest, even though it also includes a JSON request body.\n","operationId":"sendFailoverTemplateMessage","parameters":[{"name":"campaignName","in":"query","required":true,"description":"Campaign name used by the failover flow.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"201":{"description":"Failover template message accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateObjectStatusResponse"}}}},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or missing API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Send Template Message

> Send an approved WhatsApp template message.\
> \
> Use a phone number in \`to\` to address the recipient by phone number,\
> or use a WhatsApp user ID / BSUID such as \`SA\_14...\` to address the\
> recipient by user ID.\
> \
> Different template types use different \`components\` structures.<br>

```json
{"openapi":"3.0.3","info":{"title":"Taqnyat WhatsApp API - Send Templates","version":"2.0"},"tags":[{"name":"Send Templates","description":"Send approved WhatsApp template messages."}],"servers":[{"url":"https://api.taqnyat.sa/wa/v2","description":"Taqnyat WhatsApp API"}],"security":[{"ApiToken":[]}],"components":{"securitySchemes":{"ApiToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Taqnyat API token. Most supplied Postman requests place the token directly\nin the Authorization header.\n"}},"schemas":{"TemplateMessageRequest":{"type":"object","required":["to","type","template"],"properties":{"messaging_product":{"type":"string","description":"Included by template types such as Media Carousel."},"to":{"type":"string","description":"Recipient identifier. Use an international phone number for\nphone-number sending or a WhatsApp user ID / BSUID for user-ID sending.\n"},"type":{"type":"string","enum":["template"]},"template":{"type":"object","required":["name","language"],"properties":{"name":{"type":"string","description":"Approved template name."},"language":{"type":"object","required":["code"],"properties":{"code":{"type":"string","description":"Approved template language code."}}},"components":{"type":"array","description":"Some template types, including the supplied OTP and Media Carousel\nexamples, place their components inside the template object.\n","items":{"type":"object","additionalProperties":true}}}},"components":{"type":"array","description":"Template parameters and media components supplied at send time.\n","items":{"type":"object","additionalProperties":true}},"sms":{"type":"object","description":"SMS fallback configuration when applicable.","additionalProperties":true}}},"TemplateMessageResponse":{"oneOf":[{"$ref":"#/components/schemas/WhatsAppArrayStatusResponse"},{"$ref":"#/components/schemas/TemplateObjectStatusResponse"}]},"WhatsAppArrayStatusResponse":{"type":"object","properties":{"type":{"type":"string"},"statuses":{"type":"array","items":{"type":"object","properties":{"message_id":{"type":"string"},"recipient":{"type":"string"}}}}}},"TemplateObjectStatusResponse":{"type":"object","properties":{"type":{"type":"string"},"statuses":{"type":"object","properties":{"message_id":{"type":"string"},"recipient":{"type":"string"}}}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"reason":{"type":"string"}}}}},"paths":{"/messages/":{"post":{"tags":["Send Templates"],"summary":"Send Template Message","description":"Send an approved WhatsApp template message.\n\nUse a phone number in `to` to address the recipient by phone number,\nor use a WhatsApp user ID / BSUID such as `SA_14...` to address the\nrecipient by user ID.\n\nDifferent template types use different `components` structures.\n","operationId":"sendTemplateMessage","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateMessageRequest"}}}},"responses":{"200":{"description":"Template message accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateMessageResponse"}}}},"400":{"description":"Invalid template request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or missing API token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"Invalid or disallowed recipient.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
