---
title: "Send a single template message."
method: POST
path: "/whatsapp/v1/messages/templates"
tags: ["Messages"]
---

# Send a single template message.

`POST /whatsapp/v1/messages/templates`

## Request

- Base URL: `https://rest.smsportal.com`
- URL: `https://rest.smsportal.com/whatsapp/v1/messages/templates`
- Auth: HTTP basic

Example request:
            
    POST /whatsapp/v1/messages/templates
    {
        "templateName": "MyFirstTemplate",
        "businessPhoneNumberId": "841234567890",
        "language": "en",
        "recipient": "27000000001",
    }

## Request body

- TemplateRequest
  - `templateName` string, required: The name of the template to use for the send content
  - `businessPhoneNumberId` string, required: The id of the business phone number to send the message from
  - `language` string, required: Which language version of the template to use
  - `recipient` string, nullable: This field can contain a phone number or a BSUID.
  - `destinationNumber` string, nullable: This is a legacy field that we are keeping around until all customers have migrated to using the Recipient field. It is recommended to use the Recipient field instead of this one.
  - `customerId` string, nullable: Optional value that can be used to track this message through the SMSPortal system.
  - `parameters` TemplateParameters
    - `header` HeaderParameter
      - `text` string, nullable: Set this parameter if you are sending a text header in your template.
      - `media` MediaReference
        - `type` string, nullable
        - `id` integer
        - `url` string, nullable
        - `filename` string, nullable
      - `location` LocationReference
        - `latitude` number, double: The latitude coordinate of a geographic location.
        - `longitude` number, double: The longitude coordinate of a geographic location.
        - `address` string, nullable: The address of a geographic location, typically including street, city, or other identifying details.
        - `name` string, nullable: The name of the location.
    - `body` TemplateBody
      - `positional` string[], nullable: List of positional parameters for the template body, will be applied in order
      - `named` object, nullable: List of named parameters for the template body, will be swapped in where the named parameter key is matched
    - `buttons` TemplateButton[], nullable: List of button parameters for the template.
      - `buttonIndex` integer: The 0 based index of the button in the template body
      - `quickReplyPayload` string, nullable: The optional hidden payload that can be included in the webhook when the WhatsApp user presses the button
      - `couponCode` string, nullable: The code to be copied to the users clipboard when the button is pressed
      - `url` string, nullable: The URL to be opened when the button is pressed by the destination number
      - `otp` string, nullable: The one time pin to be shared with the user when the button is pressed by the destination number
  - `recipientIdentity` RecipientIdentity
    - `recipient` string, nullable
    - `phoneNumber` string, nullable
    - `bsuid` string, nullable
    - `hasPhoneNumber` boolean
    - `hasBsuid` boolean
    - `isSendable` boolean
    - `preferredIdentifier` string, nullable

## Response `200`

The template message was sent successfully

- TemplateResponse
  - `errorCode` string, nullable, required
  - `errorDetail` string, nullable, required
  - `templateName` string, nullable, required
  - `businessPhoneNumberId` string, nullable, required
  - `recipient` string, nullable, required
  - `destinationNumber` string, nullable
  - `customerId` string, nullable, required
  - `messageId` integer, required

## Other responses

- `400`: The template send was invalid, see the ErrorDetail
- `401`: The request was not properly authorized
- `500`: Something unexpected went wrong, please try again

---

[API](https://skmtc.dev/smsportal/apis/smsportal-whatsapp-api.md) - [All operations](https://skmtc.dev/smsportal/apis/smsportal-whatsapp-api/llms.txt) - [OpenAPI document](https://skmtc.dev/smsportal/apis/smsportal-whatsapp-api/revisions/d90371930885?raw)
