Sending Message Templates

POST https://gateway.lipachat.com/api/v1/whatsapp/template

Headers

Name
Value

Content-Type

application/json

apiKey

Get apiKey from App portal settings tabhttps://app.lipachat.com/app/settings

Body

Name
Type
Description

messageId

string

A unique identifier for the message. This will be used to track the message status and for deduplication purposes.

to

string

PhonReceiver phone number. It should start with a country code.

from

string

Sandbox number +254110090747 or your own WABA phone number.

template.name

string

Name of template

template.language

string

Language code e.g en

template.category

string

Accepted values are: MARKETING, UTILITY or AUTHENTICATION

template.components.header.format

string

Accepted values are: TEXT, IMAGE, VIDEO, DOCUMENT

template.components.header.text

string

Text to be sent on header

template.components.header.example

string

Should be present if text above has a variable.

template.components.body.text

string

Body text, accepts variables e.g Hello {{1}}, your balance is {{2}}

template.components.body.examples

array

Should match number of variables passed in text. For the example above it should be ['John', '2000']

template.components.footer.text

string

Optional footer text.

template.components.buttons[0].type

string

Accepted values are: PHONE_NUMBER, URL or QUICK_REPLY.

template.components.buttons[0].text

string

Text on button above.

template.components.buttons[0].phoneNumber

string

Should be passed if button type passed is PHONE_NUMBER.

template.components.buttons[0].url

string

Should be passed if button type passed is URL.

template.components.buttons[0].example

string

Applies for PHONE_NUMBER and URL.

Example Requests:

Request to send a template with type TEXT header.
{
    "messageId": "d13ce19b-678f-4a94-a910-441cfbb25b9b",
    "to": "PHONE_NUMBER",
    "from": "BUSINESS_PHONE_NUMBER",
    "template": {
        "name": "offer_830",
        "languageCode": "en",
        "components": {
            "header": {
                "type": "TEXT",
                "parameter": "Discounts"
            },
            "body": {
                "placeholders": [
                    "John","123123"
                ]
            }
        }
    }
}
Request to send a template with type MEDIA (IMAGE, VIDEO, DOCUMENT) header.
{
    "messageId": "5c9bd5ef-ebae-4071-9c26-3ba1ef693264",
    "to": "PHONE_NUMBER",
    "from": "BUSINESS_PHONE_NUMBER",
    "template": {
        "name": "declined_transfer",
        "languageCode": "en",
        "components": {
            "header":{
                "type": "IMAGE",
                "mediaUrl": "https://picsum.photos/id/237/200/300"
            },
            "body": {
                "placeholders": [
                    "John",
                    "Airtime",
                    "KES 100",
                    "Insufficient funds",
                    "funding your account"
                ]
            }
        }
    }
}
```
Request to send an Authentication template
{
    "messageId": "{{$randomUUID}}",
    "to": "{{YOUR_PHONE_NUMBER}}",
    "from": "{{WA_PHONE_NUMBER}}",
    "template": {
        "name": "lipachat_auth_template",
        "languageCode": "en",
        "components": {
            "body": {
                "placeholders": [
                    "123456"
                ]
            },
            "buttons": [
                {
                    "type": "URL",
                    "index": 0,
                    "parameter": "123456"
                }
            ]
        }
    }
}

Response

{
  "timestamp": "2023-11-22T09:59:26.720575619",
  "data": {
    "messageId": "4530f474-9d84-4905-a26f-6ba473ab890d",
    "waId": "wamid.HBgMMjU0NzE3NzQ2NTY1FQIAERgSMjNCREE1Q0YwQUJFQzE0NUQ2AA==",
    "status": "SENT",
    "statusDesc": "Template sent successfully"
  },
  "status": "success",
  "message": "",
  "errors": null
}

Last updated