Sending Message Template

  • Membuat Template Pesan:

    • Sebelum menggunakan fitur ini, Anda perlu membuat template pesan terlebih dahulu.

    • Silahkan baca Panduan OCA API untuk membuat template.

  • Data Dinamis dalam Template:

    • Template pesan dapat mencakup placeholder untuk data dinamis. Misalnya, {{name}} placeholder yang akan diganti dengan nama pelanggan ketika pesan dikirim.

    • Hal ini membuat pesan menjadi lebih personal dan relevan bagi penerima.

  • Menggunakan Template:

    • Setelah template dibuat dan disetujui, Anda bisa menggunakan endpoint API POST /api/v2/push/message untuk mengirimkan pesan kepada pelanggan.

    • Anda akan mengirimkan template ID bersama dengan data yang diperlukan.

URL:

[POST] https://wa01.ocatelkom.co.id/api/v2/push/message 

Header:

Authorization : {{JWT_AUTH}}
content-type : application/json

Body:

{
    "message": {
        "type": "template",
        "template": {
            "template_code_id": "{{fill_your_template_code_id}}",
            "payload": [
                {
                    "position": "body",
                    "parameters": [
                        {
                            "type": "text",
                            "text": "{{fill_value_varibale_on_body}}"
                        }
                    ]
                }
            ]
        }
    },
    "phone_number": "{{fill_your_recipient_number}}"
}

Response:

{
    "msgid": "xxxx9f4b-334a-27b2-xxxxb1e2xxxx",
    "success": true
}

The main Object

Name
Type
Required
Description

phone_number

String

Yes

Destination of phone number Values : country code + phone number (+6281381475159, 6281381475159)

message

Object

Yes

Contain all message information body

The message Object

Name
Type
Required
Description

type

String

Yes

The type of your message

Values : template

template

Object

Yes

Contain template information

The template Object

Name
Type
Required
Description

template_code_id

String

Yes

The registered template message, you will be given the template code id for your requested template Values : template code id

payload

Array of Object

Yes

Contain array of information for specific template

The payload Array of Component Object

Name
Type
Required
Description

position

String

Yes, if template use this component

Describe the position type Values : header | body | button

parameters

Array of Object

Yes, if template use this component

Array containing the content of each position type

The Parameters Body Component Type Position

Name
Type
Required
Description

type

String

Yes

Describe the type for parameters Values : text

text

String

Yes

Contain value of text

The Parameters Header Component Type Position

Name
Type
Required
Description

type

String

Yes

Describe the type value Values : text | image | video | document

text

String

Yes, when “type” : “text”

Contain value of text

image

Object

Yes, when “type” : “image”

Media object containing image

video

Object

Yes, when “type” : “video”

Media object containing video

document

Object

Yes, when “type” : “document”

Media object containing document

The image, video & document Object

Name
Type
Required
Description

url

String

Yes

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.

The Parameters Button Components Type Position

Name
Type
Required
Description

sub_types

String

Yes

Describe the sub_type value Values : quick_reply | url_dynamic

index

Number

Yes

Contains the sequence number of the button use. The sequence number start from 0

parameters

Object

Yes

Contains an array of information for a specific sub_type

The Parameters sub_type Type Position

Name
Type
Required
Description

type

String

Yes

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.

payload

String

Yes, when “type” : “payload”

Contain text for the recepient to use to do a quick reply

text

String

Yes, when “type” : “text”

Containt text that will be used for dynamic_url

Last updated