Creating a Template

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

Pass your WABA number or Sandbox phone number as the value of PHONE_NUMBER

Headers

Name
Value

Content-Type

application/json

apiKey

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

Body

Name
Type
Description

name

string

Name of template

language

string

Language code e.g en

category

string

Accepted values are: MARKETING, UTILITY or AUTHENTICATION.

component.header.format

string

Accepted values are: TEXT, IMAGE, VIDEO, DOCUMENT

component.header.text

string

Text to be sent on header

component.header.example

string

Should be present if text above has a variable.

component.body.text

string

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

component.body.examples

array

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

component.footer.text

string

Optional footer text.

component.buttons[0].type

string

Accepted values are: PHONE_NUMBER, URL or QUICK_REPLY.

component.buttons[0].text

string

Text on button above.

component.buttons[0].phoneNumber

string

Should be passed if button type passed is PHONE_NUMBER.

component.buttons[0].url

string

Should be passed if button type passed is URL.

component.buttons[0].example

string

Applies for PHONE_NUMBER and URL.

component.header, component.footer, component.buttons objects are optional.

Sample Requests:

Request to create a template with header and body.
{
    "name": "temp_lower_68",
    "language": "en",
    "category": "MARKETING",
    "component": {
        "header": {
            "format": "TEXT",
            "text": "{{1}} registration",
            "example": "July"
        },
        "body": {
            "text": "Hi {{1}}, we have a new user registered click {{2}} to view.",
            "examples": [
                "John",
                "http://lipachat.com/offers/ASHSH"
            ]
        }
    }
}
Request to create a template with header, body and quick reply

{
    "name": "transaction_update",
    "language": "en",
    "category": "UTILITY",
    "component": {
        "body": {
            "text": "Dear {{1}},\nYour {{2}} payment of {{3}} ",
            "examples": [
                "Mary",
                "Airtime",
                "KES 100"
            ]
        },
        "footer": {
            "text": "The Test Bank Team"
        },
        "buttons": [
            {
                "type": "QUICK_REPLY",
                "text": "Ask a Question"
            },
            {
                "type": "QUICK_REPLY",
                "text": "Chat with Support"
            }
        ]
    }
}
Request to create a template with quick reply buttons
{
    "name": "lipachat_marketing_quick_reply",
    "language": "en",
    "category": "MARKETING",
    "component": {
        "body": {
            "text": "Hi {{1}}, we noticed that you tried to reach us but we were not available. Would you like to:",
            "examples": [
                "Mary"
            ]
        },
        "footer": null,
        "buttons": [
            {
                "type": "PHONE_NUMBER",
                "text": "CALL US",
                "phoneNumber": "+254110090747",
                "example": "254110090747"
            },
            {
                "type": "URL",
                "text": "Raise a ticket",
                "url": "https://lipachat.com/raiseTicket",
                "example": "https://lipachat.com/raiseTicket"
            }
        ]
    }
}
Request to create a template with a media header

{
    "name": "payment_processed",
    "language": "en",
    "category": "UTILITY",
    "component": {
        "header": {
            "format": "IMAGE",
            "mediaId": "4:MS5qcGc=:aW1hZ2UvanBlZw==:ARbxC3pH-hnOZSObdto4tGAjuB2-INNLk98lRBxGZYLj5XtfKtQjGSzxp0V8fQde-7nmyvbzlpWY2bIvVYvNg8S8SpQyyUueV9xfvbKcPPd7sQ:e:1723555121:564683789153111:100074672771173:ARZ8O5E1vaOJ6415124"
        },
        "body": {
            "text": "Dear {{1}},\nYour {{2}} payment of {{3}} has been processed",
            "examples": [
                "Mary",
                "Funds Transfer",
                "KES 100"
            ]
        },
        "footer": {
            "text": "The Test Bank Team"
        },
        "buttons": [
            {
                "type": "QUICK_REPLY",
                "text": "Ask a Question"
            },
            {
                "type": "QUICK_REPLY",
                "text": "Chat with Support"
            }
        ]
    }
}
Request to create an authentication template
{
    "name": "lipachat_auth_template",
    "language": "en",
    "category": "AUTHENTICATION",
    "component": {
        "body": {
            "addSecurityRecommendation": true // optional
        },
        "footer": {
            "codeExpirationMinutes": 10 // optional
        },
        "buttons": [
            {
                "type": "OTP",
                "otpType": "COPY_CODE",
                "text": "Copy Code"
            }
        ]
    }
}

Response


{
    "timestamp": null,
    "data": {
        "id": "1661737361284034",
        "status": "APPROVED",
        "category": "MARKETING"
    },
    "status": "success",
    "message": "success",
    "errors": null
}

Uploading Template media

When creating a template with media on the header, you should first call the endpoint below to upload media then use the id returned to create the message template.

POST https://gateway.lipachat.com/api/v1/template/upload/file

Headers

Name
Value

Content-Type

multipart/form-data

apiKey

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

Body

Name
Type
Description

file

file

Image, video or document.

Response

{
    "timestamp": null,
    "data": "4:V2hhdHNBcHAgSW1hZ2UgMjAyNC0wOS0xNSBhdCAxOS4wMS41MC5qcGVn:aW1hZ2UvanBlZw==:ARZi4gxBasbSbhXEXcfZSR7WtrgQCS-xs31BESau0ROb_fh2SFu1xndRAoY41h57QxRDZVsTFF3LyKGKIzxaRMwO_Q0xGZaw9XZ4LNEGqQrWEw:e:1726767043:564683789153111:100074672771173:ARbLETnUSOWfTwBzPfQ",
    "status": "success",
    "message": "success",
    "errors": null
}

use the value of data while calling create template endpoint, for templates with media in the header.

Try out from Postman here

Last updated