Lipachat Docs
  • Lipachat Docs
  • Getting Started
    • Getting Started with Lipachat
  • API
    • Sending Messages
    • Sending Media
    • Sending Buttons
    • Sending Interactive Lists
    • Templates
      • Creating a Template
      • Updating a Template
      • Listing Message Templates
      • Sending Message Templates
    • Whatsapp Flows
      • Creating a flow
      • Updating a flow
      • Get flow preview
      • Publish a flow
      • Send a flow
      • List all flows
    • Webhooks
  • Reference
    • Sandbox
  • Go Live
  • Guides
    • Build A Chat Bot
  • CRM Workflow
Powered by GitBook
On this page
  1. API
  2. Templates

Sending Message Templates

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

Headers

Name
Value

Content-Type

application/json

apiKey

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
}
{
    "timestamp": "2024-09-15T20:06:38.675567555",
    "data": null,
    "status": "error",
    "message": "Request failed. please provide missing content",
    "errors": null
}
{
    "timestamp": "2024-09-15T20:07:23.464199513",
    "data": null,
    "status": "success",
    "message": "Invalid credentials",
    "errors": null
}
PreviousListing Message TemplatesNextWhatsapp Flows

Last updated 2 months ago

Get apiKey from App portal settings tab

https://app.lipachat.com/app/settings