📂Template Messages

Ease repeating messages, and also initiate conversation sessions with customers.

Template List

GET /templates/:appId

Retrieve the list of available template messages.

Headers

Key
Value

Content-Type

application/json

Authorization

Bearer <token>

Query Params

Key
Description
Required

limit

Data size per page. Default: 10. Max: 50.

before

Prohibited if after is filled.

after

Prohibited if before is filled.

Path Variables

Key
Description
Required

:appId

Application ID

Response

{
    "statusCode": 200,
    "code": "OK",
    "message": "The request has been successfully processed.",
    "data": [
        {
            "id": "1519350671883350",
            "name": "otp_code",
            "language": "id",
            "category": "AUTHENTICATION",
            "status": "APPROVED"
        },
        // ...
    ],
    "meta": {
        "cursors": {
            "before": "MAZDZD",
            "after": "OQZDZD"
        }
    }
}

Template Details

GET /templates/:appId/:templateId

Retrieve specific detailed template messages.

Headers

Key
Value

Content-Type

application/json

Authorization

Bearer <token>

Path Variables

Key
Description
Required

:appId

Application ID

:templateId

Template message ID

Response

{
    "statusCode": 200,
    "code": "OK",
    "message": "The request has been successfully processed.",
    "data": {
        "id": "1519350671883350",
        "name": "otp_code",
        "language": "id",
        "category": "AUTHENTICATION",
        "status": "APPROVED",
        "components": [
            {
                "type": "HEADER",
                "format": "TEXT",
                "text": "{{1}}",
                "example": {
                    "header_text": [
                        "Unswer"
                    ]
                }
            },
            {
                "type": "BODY",
                "text": "Kode OTP Anda adalah : *{{1}}*\n\nJaga kerahasiaan kode OTP tersebut, jangan berikan kepada siapapun.",
                "example": {
                    "body_text": [
                        [
                            "123456"
                        ]
                    ]
                }
            }
        ],
        "$extras": {
            "cta_url_link_tracking_opted_out": false,
            "quality_score": {
                "score": "UNKNOWN",
                "date": 1715671267
            },
            "rejected_reason": "NONE"
        }
    }
}

Create Template

POST /templates/:appId

Create template messages programmatically.

Headers

Key
Value

Content-Type

application/json

Authorization

Bearer <token>

Path Variables

Name
Description
Required

:appId

Application ID

Body Raw

Key
Description
Required

name

Template name in snake_case format.

category

Template category. Supported: UTILITY, MARKETING, AUTHENTICATION.

sub_category

Sub category of the template. Supported: ORDER_DETAILS, ORDER_STATUS.

language

ttl

Time to live for message template sent. If users are offline for more than TTL duration after message template is sent, message will be dropped from message queue and will not be delivered.

Only allowed for AUTHENTICATION message templates.

components[]

.type

Component type. Supported: GREETING, HEADER, BODY, FOOTER, BUTTONS, CAROUSEL, LIMITED_TIME_OFFER.

components[]

.format

Component format. Supported: TEXT, IMAGE, DOCUMENT, VIDEO, LOCATION.

components[]

.text

Component text. Required when the type is HEADER, BODY or FOOTER.

components[]

.buttons[]

.type

Button type. Supported: QUICK_REPLY, URL, PHONE_NUMBER, OTP, MPM, CATALOG, FLOW, VOICE_CALL.

components[]

.buttons[]

.text

Button text.

components[]

.buttons[]

.url

Button URL. Required when the type is URL.

components[]

.buttons[]

.phone_number

Button phone number in string format. Required when the type is PHONE_NUMBER.

components[]

.buttons[]

.example[]

Button text or URL segment example. Note: array of string.

components[]

.buttons[]

.flow_id

Button flow ID. Required when the type is FLOW.

components[]

.example

.header_text[]

Placeholder examples. Required when the type is HEADER. Templates will not be approved without examples.

components[]

.example

.body_text[][]

Placeholder examples. This relates to the text column in the related component. Templates will not be approved without examples.

components[]

.example

.header_handle[]

Placeholder examples. Required if the type is HEADER and the format is other than TEXT. Templates will not be approved without examples.

Example Body Raw

{
    "name": "greeting_message",
    "category": "UTILITY",
    "language": "id",
    "components": [
        {
            "type": "BODY",
            "text": "Halo {{1}}, selamat datang di {{2}}.",
            "example": {
                "body_text": [
                    ["John Doe", "Unswer"]
                ]
            }
        }
    ]
}

Response

{
    "statusCode": 202,
    "code": "OK",
    "message": "The request has been successfully received and is being processed.",
    "data": {
        "id": "954710036062606",
        "status": "PENDING",
        "category": "UTILITY"
    }
}

Delete Template Message

DELETE /templates/:appId/:templateId

Delete template messages from your application.

Headers

Key
Value

Content-Type

application/json

Authorization

Bearer <token>

Path Variables

Key
Description
Required

:appId

Application ID

:templateId

Template message ID

Response

{
    "statusCode": 200,
    "code": "OK",
    "message": "Data has been successfully deleted."
}

Last updated