Chatlayer Documentation
Get in touchAbout Chatlayer
  • Welcome
  • What's new
  • Send feedback
  • start quickly
    • Leadzy tutorial
      • 0. Introduction
      • 1. New bot, new block
      • 2. Understand your users
      • 3. Collect and display user input
      • 4. Steer the conversation with Conditions
      • 5. Empower your bot with Actions
      • 6. Set up a channel and publish your bot
    • Templates
      • Banking
      • E-Commerce Returns
      • E-Bike Shop
      • E-Scooter Support
      • Feedback
      • Find Nearest Location
      • GPT
      • 🆕Gym
      • Job applications
      • Knowledge base AI template
      • Lead generation
      • 🆕NPS
      • Restaurant
      • Retail
  • navigation
    • Analytics
      • Dashboard
      • Customers
      • Conversations
      • User flow
      • Intents
      • 🆕Funnels [Beta]
    • Bot builder
      • Flows
        • Canvas functionalities
        • Collaborate with team members
        • Manage your flows
        • 🆕[Beta] Export and import flows
      • Bot dialogs view
      • Translations
      • Events
    • NLP
      • Dashboard
      • Intents
      • Expressions
      • Entities
      • Train
      • NLP settings
      • Improve
    • Knowledge base AI
      • Add content to your KBAI
      • Build your KBAI flow
      • Use your KBAI source URL in a button
      • Use tags to limit your KBAI content
      • 🆕Use Tables to store your KBAI questions
      • 🆕Manage handover where KBAI is unsatisfactory
    • History
      • Conversations
      • Execution logs
      • Versions
    • Channels
    • Tables
      • Create a table with records
      • Column types
      • Operate on your records
        • Insert record
        • Update record
        • Retrieve record
        • Delete record
      • API
    • Settings
      • Bot settings
      • Offloading
      • Variables
      • Voice
      • Import/Export
  • build your bot
    • Conversation design
      • Plan your bot
      • Conversation design workflow
    • Flow logic
      • Blocks
        • Message
        • Condition
        • Collect input
        • Action
      • Go-to connections
    • 🆕Emulator
    • Tips & best practices
      • Route your flow depending on the time
      • Improve the Not understood block
        • How to create better not understood messages
        • Not understood counter
        • Not understood Google search
      • Go to previous block
      • Recognizing a returning user
      • Skip introduction message
      • Route your flow depending on the channel
      • Reuse flows
      • Connect two bots to each other
  • understand users
    • Natural language processing (NLP)
      • Basic NLP concepts
      • Detect information with entities
        • Match entities
        • Contextual entities
        • System entities
        • Composite entities
      • NLP best practices
        • Word order and diversity of expressions
      • AI intent booster
      • Train your NLP
      • Context
      • NLP import & export
      • Sentiment analysis
    • Languages
      • Supported languages
      • Make your bot multilingual
      • Change language within the conversation
  • set up channels
    • Add a channel to your bot
    • All channels
      • 🚨Facebook Messenger [Deprecated soon]
        • Facebook Admin Removal
        • Facebook Webview Whitelisting
        • Facebook Messenger API updates for Europe
      • 🚨Google Assistant [Deprecated soon]
      • Webhook
      • Web
        • 🚨Web V1 [Deprecated]
          • Customize web widget
          • Live example web widget
        • 🆕Web V2
          • 🆕From Web V1 to V2
          • 🆕Web V2 methods and options
    • Sinch Conversation API
      • Configure your Sinch Conversation API
      • 🆕 Make the most of RCS with Carousels
      • WhatsApp Business API
  • integrate & code
    • API calls
      • Configure your API integration
      • Advanced API features
      • V1 API Reference
      • Custom integrations 101
    • Code editor
      • [Example] Sending data to Airtable (POST)
      • [Example] Retrieving data from Airtable (GET)
      • [Example] Making SOAP requests
    • App integrations
      • Airtable
      • Freshdesk
      • Freshdesk Messaging
      • 🆕Gmail
      • Intercom
      • Mailgun
      • OpenAI: GPT-3, ChatGPT and GPT-4
      • Salesforce
      • 🆕Slack
      • Topdesk
      • Zendesk Support
      • Zendesk Sunshine (beta)
    • 🆕Expression syntax
    • Human handover & live chat
      • Sinch Contact Pro
      • #Interact
      • Genesys Cloud
      • Offloading Webhook
      • Salesforce Service Cloud
      • Sparkcentral by Hootsuite
      • Zendesk Chat
    • Chatlayer messages specifications
  • Publish
    • Publish your bot
      • Publish a flow
  • Analyze & maintain
    • Analytics definitions
    • Data retention
    • Maintenance
    • Session
    • Track events for analytics
  • VOICE
    • 🆕Send bot response as audio
    • Voicebots
      • Create a voicebot
      • Voicebot-specific actions
      • Test your voicebot
      • From chat to voice
  • access & support
    • Identity & Access
      • Single Sign-On (SAML SSO)
    • Billing & subscription
    • Get in touch
    • Chatlayer glossary
    • SaaS Regions & IP Ranges
    • Status
    • Debug your bot
      • No correct response
      • Collect input not working
      • Video isn't working
Powered by GitBook
On this page
  • Text
  • Button Template
  • Quick replies
  • Generic template
  • List template
  • Attachment
  • Rich text

Was this helpful?

  1. integrate & code

Chatlayer messages specifications

Get to know what the code of the Chatlayer messages looks like so that you can use it in your API calls or your offloadings.

Chatlayer.ai supports different types of chat messages, each with its own object structure. Chat messages can be sent:

  • In the response from the API plugin

  • From your webhook to Chatlayer.ai

Each message has two mandatory fields:

  • type: the messages type (carousel, buttons, list, media, text, …)

  • config: the message configuration

Text

A text message includes a simple bot text message.

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "text": "Hi, I'm a chatbot"
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Property

Value

Description

text

string

The user test message.

Button Template

A button template includes a simple bot text message and an array of button objects.

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "button",
        "text": "Hello, in which language can I help you?",
        "buttons": [
          {
            "type": "postback",
            "title": "Nederlands",
            "payload": "437a034cde170b50de1b6a87d1cba104e39b1f6e"
          },
          {
            "type": "postback",
            "title": "English",
            "payload": "a6a318dd6afe997f282b3c7472e038a2e0f4046a"
          },
        ]
      }
    }
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Message object for button template:

Property

Value

Description

attachment

object

The attachment object.

Attachment object:

Property

Value

Description

type

string

The attachment type (template)

payload

object

The attachment payload object. The object structure depends of the attachment type

Attachment payload object:

Property

Value

Description

template_type

string

The template type (button)

text

string (optional)

The text above the buttons ( only for a button template type)

buttons

array

An array of button objects

Button object:

Property

Value

Description

type

string

The button type (web_url - postback - phone_number - element_share)

title

string

The button caption

payload

string (will contain the phone number when type is phone_number) - optional

The button payload. Only for postback type buttons. This is an Opaque identifier please don't try to change or extract meaning out of it.

url

string - optional

The button url. Only for url type buttons

Quick replies

A quick reply message includes a simple bot text message and an array of quick reply objects.

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "text": "Hello, in which language can I help you?",
    "quick_replies": [
      {
        "content_type": "text",
        "title": "Nederlands",
        "payload": "c3e30be2f30687fea0ae419acaeb9d77261631a9",
        "image_url": "https://domain/logo.png"
      },
      {
        "content_type": "text",
        "title": "English",
        "payload": "2e29412e82c8eea8c8b0c170661070d28929a900",
        "image_url": "https://domain/logo.png"
      },
    ]
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Message object for quick replies:

Property

Value

Description

text

string

The text before the quick replies.

quick_replies

array

An array of quick reply objects

Quick reply object:

Property

Value

Description

content_type

string

The quick reply content type (text)

title

string

The button caption

payload

string

The quick reply payload. This is an Opaque identifier please don't try to change or extract meaning out of it.

Generic template

A generic template (carousel) includes a list of generic template elements. The generic template element is a simple structured message that includes a title, subtitle, image, and up to three buttons

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "generic",
        "elements": [
          {
             "title": "Language",
             "subtitle": "Please set your language",
             "image_url": "https://domain/lang.png",
             "item_url": "https://domain/lang",
             "buttons": [
               {
                 "type": "postback",
                 "title": "Nederlands",
                 "payload": "f0512bd2fcddc53963056dc0d63b52b8caa902ff"
               },
               {
                 "type": "postback",
                 "title": "English",
                 "payload": "4562ae76c34a13647fab90425c68a486b8acf356"
               },
            ]
          }
        ]
      }
    }
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Message object for generic template:

Property

Value

Description

attachment

object

The attachment object.

Attachment object:

Property

Value

Description

type

string

The attachment type (template)

payload

object

The attachment payload object. The object structure depends of the attachment type

Attachment payload object:

Property

Value

Description

template_type

string

The template type (generic)

elements

array

An array of generic template elements (carousel cards)

Generic template element object:

Property

Value

Description

title

string

The carousel card title

subtitle

string

The carousel card subtitle

image_url

string

The carousel card image

item_url

string

The carousel card url. When the user clicks the image the web page opens in a new browser tab.

buttons

array

An array of button objects

Button object:

Property

Value

Description

type

string

The button type (web_url - postback - phone_number - element share)

title

string

The button caption

payload

string (will contain the phone number when type is phone_number) - optional

The button payload. Only for postback type buttons. This is an Opaque identifier please don't try to change or extract meaning out of it.

url

string - optional

The button url. Only for url type buttons

List template

The list template is a list of 2-4 structured items with an optional global button rendered at the bottom. Each item may contain a thumbnail image, title, subtitle, and one button. You may also specify a default_action object that sets a URL that will be opened when the item is tapped.

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "attachment": {
      "type": "template",
      "payload": {
        "template_type": "list",
        "elements": [
          {
             "title": "Language",
             "subtitle": "Select your language",
             "image_url": "https://domain/lang.png",
             "default_action": {
                "type": "web_url",
                "url": "default_url"
              }
             "buttons": [
               {
                 "type": "postback",
                 "title": "Nederlands",
                 "payload": "76601d56d0619ef87552bbfbbfcd714c4fda513b"
               }
            ]
          }
        ],
        "buttons": []
      }
    }
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Message object for list template:

Property

Value

Description

attachment

object

The attachment object.

Attachment object:

Property

Value

Description

type

string

The attachment type (template)

payload

object

The attachment payload object. The object structure depends of the attachment type

Attachment payload object:

Property

Value

Description

template_type

string

The template type (list)

elements

array

An array of list elements

buttons

array

An array of general list button objects

List template element object:

Property

Value

Description

title

string

The carousel card title

subtitle

string

The carousel card subtitle

image_url

string

The carousel card image

default_action

object

The default action when the user taps the list item.

buttons

array

An array of list item button objects

Default action object:

Property

Value

Description

type

string

The action type (web_url)

url

string

The action ur. When the user taps the list element this web page will open in a new browser tab.

Button object:

Property

Value

Description

type

string

The button type (web_url - postback - phone_numberl - element share)

title

string

The button caption

payload

string (type phone_number) - optional

The button payload. Only for postback type buttons. This is an Opaque identifier please don't try to change or extract meaning out of it.

url

string - optional

The button url. Only for url type buttons

Attachment

An attachment represents a file such as images and video.

Request format:

{
  "senderId": "a7355930-fa92-11e7-8308-2f056e75d1ee",
  "message":  {
    "attachment": {
      "type": "image"
      "payload": {
        "url": "image_url",
      }
    }
  },
  "messageCounter": 1,
  "verifyToken": "8wMsLZkdDPT64nqh"
}

Message object for attachment:

Property

Value

Description

attachment

object

The attachment object.

Attachment object:

Property

Value

Description

type

string

The attachment type (image-video)

payload

object

The attachment payload object. The object structure depends of the attachment type

Attachment payload object:

Property

Value

Description

url

string

The attachment url

Rich text

Rich text is text to which formatting is applied. Possible formatting is bold, italic, underlined, hyperlink to URL, hyperlink to block, heading (1-4), bulleted list and ordered list.

Request format:

{
  senderId: 'a7355930-fa92-11e7-8308-2f056e75d1ee',
  verifyToken: 'e63131e1-459f-45aa-be42-666e1e4ef197',
  message: {
    template: {
      __typename: 'RichTextMessageTemplate',
      order: 1,
      configTranslations: [Object]
    },
    richText: '<p>Paragraph</p>\n' +
      '<p><strong>Bold</strong></p>\n' +
      '<p><em>Italic</em></p>\n' +
      '<p><u>Underlined</u></p>\n' +
      '<p><a href="https://www.sinch.com" target="_blank" rel="noopener noreferrer">Hyperlink</a></p>\n' +
      '<p><a href="f36f9056-2659-4d59-8940-4e9c7d3855a3" target="_blank" rel="noopener noreferrer">Go to bot dialog</a></p>\n' +
      '<h1>Heading 1</h1>\n' +
      '<h2>Heading 2</h2>\n' +
      '<h3>Heading 3</h3>\n' +
      '<h4>Heading 4</h4>\n' +
      '<ul>\n' +
      '<li>Bulleted list</li>\n' +
      '</ul>\n' +
      '<ol>\n' +
      '<li>Ordered list</li>\n' +
      '</ol>',
    type: 'richText'
  },
  messageCounter: 2,
  nlp: { intent: { name: null, score: null } },
  dialogstate: {
    id: 'f444b20b-370a-434d-af00-822cbce056ec',
    name: 'Introduction',
    label: null
  }
}

Message object for attachment:

Property

Value

Description

richText

string

The rich text message

PreviousZendesk ChatNextPublish your bot

Last updated 1 year ago

Was this helpful?