Dokumen blok Dynamis

Response Reference Docs

Format respon:

Format respons untuk mengirim pesan dinamis:

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text"
      },
      {
        ...Another messages
      }
    ],
    "actions": [  //optional
      {
        "action": "add_tag",
        "tag_id": 12345
      },
      {
        ...Another actions
      }
    ],
    "quick_replies": [ //optional
      {
        "type": "flow",
        "caption": "Go",
        "flow_id": 12345
      },
      {
        ...Another quick replies
      }
    ]
  }
}

Blok dinamis API versi v2 Blok dinamis memiliki batas untuk memiliki tidak lebih dari 10 pesan dalam blok messages 11 balasan cepat, dan 5 tindakan. Properti"buttons", "actions", "quick_replies" itu opsional.

Format pesan

Kirim Teks:

Menggunakan respons ini untuk kirimkan pesan teks url, flow dan tombol call dapat digunakan dengan pesan. Properti"buttons", "actions", "quick_replies" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Kirim Gambar

Respon ini digunakan untuk mengirim file gambar. Messenger mendukung gambar JPG, PNG dan GIF. Anda dapat menggunakan tombol url, call, flow. Properti "buttons", "actions", "quick_replies" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "image",
        "url": "https://statics.pancake.vn/user-content.pancake.vn/photo/xyz.png",
        "buttons": []
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Kirim file video

Respon ini digunakan untuk mengirim file video. Messenger mendukung video, yang berukuran hingga 25MB. Anda dapat menggunakan tombol url, call, flow. Properti"buttons", "actions", "quick_replies" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "video",
        "url": "https://statics.pancake.vn/user-content.pancake.vn/video/xyz.mpg",
        "buttons": []
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Kirim file audio

Respons ini digunakan untuk mengirim file audio. Messenger mendukung audio, yang berukuran hingga 25MB. Anda dapat menggunakan tombol url, call, flow. Properti"buttons", "actions", "quick_replies" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "audio",
        "url": "https://statics.pancake.vn/user-content.pancake.vn/audio/xyz.mp3",
        "buttons": []
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Kirim file

Respons ini digunakan untuk mengirim file lain, yang tidak lebih besar dari 25MB. Properti"actions", "quick_replies" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "file",
        "url": "https://statics.pancake.vn/user-content.pancake.vn/file/xyz.pdf"
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Sa WhatsApp, nangangailangan ito ng hindi bababa sa 1 button sa gallery

This response is used to send a horizontal scrollable gallery. You can use url, call, flow buttons. The "buttons", "actions", "quick_replies" properties are optional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "cards",
        "elements": [
          {
            "title": "Card title",
            "subtitle": "card text",
            "image_url": "https://statics.pancake.vn/user-content.pancake.vn/photo/xyz.png",
            "buttons": []
          }
        ],
        "image_aspect_ratio": "horizontal"
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

We strongly suggest to use HTTPS protocol for your URLs. image_aspect_ratio - The aspect ratio used to render cards. You can use horizontal or square (default horizontal).

Tombol

Anda dapat menggunakan tombol dengan jenis yang beda: call, url, flow. Anda dapat memberikan tindakan kustom untuk dilakukan dengan tombol. Tindakan hanya dapat dilampirkan ke jenis tombolurl, flow. Tindakan untuk tombol harus mematuhi format dan batasan yang sama seperti yang dijelaskan dalam format Tindakan di bawah. Properti "actions"itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          },
          {
            ...Another buttons
          }
        ]
      },
      {
        ...Another messages
      }
    ],
    "actions": [  //optional
      {
        "action": "add_tag",
        "tag_id": 12345
      },
      {
        ...Another actions
      }
    ],
    "quick_replies": [ //optional
      {
        "type": "flow",
        "caption": "Go",
        "flow_id": 12345
      },
      {
        ...Another quick replies
      }
    ]
  }
}

Tombol "Telpon"

Tidak tersedia di WhatsApp

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "call",
            "title": "Call me",
            "phone": "+1 (555) 555-55-55"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Tombol Url

Tidak tersedia di WhatsApp

webview_sizeada 3 jenis:

full - (100%),

medium - (75%),

compact - (50%)

Properti "webview_size" itu opsional.

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io",
            "webview_size": "full"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Tombol masuk Flow

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "flow",
            "title": "Go",
            "flow_id": 12345
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

flow_id butuh flow ID (dapat ditemukan di URL saat flow dibuka)

Format Tindakan

Properti actions dari respons server itu opsional

Tindakan tambah tag

Gunakan respons ini untuk menambahkan tag ke pelanggan. Tag dengan nama yang sama harus ada di bot Anda:

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [
      {
        "action": "add_tag",
        "tag_id": 12345
      }
    ],
    "quick_replies": []
  }
}

Nama tag yang dikirim menggunakan parameter tag_name harus cocok dengan salah satu tag yang ada dalam bot Botcake

Tindakan hapus tag

Gunakan respons ini untuk menghapus tag dari pelanggan. Tag dengan nama yang sama harus ada di bot Anda:

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [
      {
        "action": "remove_tag",
        "tag_id": 12345
      }
    ],
    "quick_replies": []
  }
}

Balasan cepat

Masuk flow Balasan Cepat

Hanya tersedia di Messenger atau Instagram

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": [
      {
        "type": "flow",
        "caption": "Go",
        "flow_id": 12345
      }
    ]
  }
}

flow_id butuh flow ID (dapat ditemukan di URL saat flow dibuka)

Go to phone number quick reply

Hanya tersedia di Messenger

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": [
      {
        "type": "user_phone_number"
      }
    ]
  }
}

Go to email quick reply

Hanya tersedia di Messenger

{
  "version": "v2",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "title": "External link",
            "url": "https://botcake.io"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": [
      {
        "type": "user_email"
      }
    ]
  }
}

Variables

In dynamic block request body, you can use Full Subscriber Data variable, that contains all subscriber’s information:

{
    "user_first_name": "Firstname",
    "user_last_name": "Lastname",
    "user_full_name": "Subscriber",
    "#GENDER{{MALE|FEMALE|UNKNOWN}}": "MALE",
    "psid": "123456xxxxxx",
    "ad_id": "123456xxxxx",
    "page_name": "Botcake",
    "{{SPIN_1|SPIN_2}}": "SPIN_1",
    "email": "abc@gmail.com",
    "phone": "+8438409xxxx",
    "address": "Ha Noi",
    "current_date": "2018-07-02T00:00:00+00:00",
    "CONVERSATION_LINK": "https://pages.fm/323087334762615?c_id=323087334762615_xxxxxxxxxx",
}

Last updated