Conversational AI
  • Introduction
  • Getting started
    • Getting started
    • Adding content to your bot
    • Capture information with entities
    • Capture information with input validation
    • Reusing intents with context
    • Flow navigation with variables
    • Adding new users to your account
  • Understanding users
    • Natural Language Processing (NLP)
      • NLP threshold
      • NLP Import & Export
      • Train your bot with actual user messages
      • NLP Dashboard & NLP Improve
      • Synonym entities
      • System entities
      • Supported languages
      • Intent templates
    • Expression generator
    • Context
    • Multi-language bots
  • Bot answers
    • Bot dialogs
      • Message components
      • Go To
      • Input Validation
      • Action
      • Translations
    • Conversations
    • Analytics
      • User flow
    • Publishing your bot
    • Events
    • Reuse flows
    • Settings
      • Variables
  • Integrations
    • API integration
      • Advanced API integrations
    • Chat message structure for API's
    • Retrieving data from Airtable (GET)
    • Sending data to Airtable (POST)
    • Human handover & live chat
      • #Interact
      • RingCentral Engage Digital
      • Genesys Cloud
      • Help Scout
      • Zendesk Chat
      • Intercom
      • Sparkcentral (beta)
      • Offloading Webhook
  • Channels
    • Channels
    • Facebook Messenger
      • Facebook Admin Removal
      • Facebook Webview Whitelisting
    • WhatsApp Business API
    • Google Assistant
    • Webhook Channel API
    • Chat widget
    • Phone & voice
    • Workplace from Facebook
    • Sinch Conversation API (beta)
  • Tips & Best practices
    • How to NLP
    • Creating diverse expressions
    • Why is my bot not responding the way I want it to?
    • What makes a good chatbot?
    • How to recognize a returning bot user
    • Gathering user feedback
    • Using time in your chatbot
Powered by GitBook
On this page
  • Chat Messages
  • Text Messages
  • Button template
  • Quick replies template
  • Carousel
  • Media

Was this helpful?

  1. Integrations

Chat message structure for API's

Chat Messages

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

  • As a 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 Messages

A text message includes an array of text messages.

Request format

const textMessage = {
  config: {
    textMessages: [{ text: '1st random text' }, { text: '2nd random text' }],
  },
  type: 'text',
};

Configuration object

Property

type

Description

textMessages

Array

A list of text message objects

Text message object

Property

type

Description

text

String

A text message

Button template

A button template includes an array of buttons and an array of text messages. A button can have three types

  • postback: redirects the user to a new dialog state. It is possible to save key values in the user session.

  • web_url: opens the website for this url.

  • phone_number: starts a telephone call.

Request format

{
  config: {
    buttons: [
      {
        payload: {
          nextDialogstateId: 'eedeb3df-ebb1-46c0-836f-b85b784c42b1',
          params: [{ key: 'location', value: 'meulebeke' }],
        },
        title: 'gottotest',
        type: 'postback',
      },
      {
        title: 'URL button',
        type: 'web_url',
        url: 'https://www.google.com',
      },
      {
        payload: '193248u9',
        title: 'tel',
        type: 'phone_number',
      },
    ],
    textMessages: [{ text: '1st random text' }, { text: '2nd random text' }],
  },
  type: 'buttons',
}

Configuration object

Property

type

Description

textMessages

Array

A list of text message objects

buttons

Array

A list of button objects

Text message object

Property

type

Description

text

String

A text message

Button object

Property

type

Description

title

String

Title

type

String

Button type: postback / web_url / call

payload (only for type postback and phone_number)

String for type phone_number

Object for type

The button payload. An object with next dialog state and parameter key/value combinations for type postback. A telephone number for type phone_number.

url (only for type web_url)

String

The website url to open

call (only for type phone_number)

String

The phone number to call

Payload object for type postback

Property

type

Description

nextDialogstateId

String

Redirect the user to this dialog state

params

Array

A list of parameter objects. A parameter object has a key and value property

Quick replies template

A quick replies template includes an list of quick replies and a list of text messages.

Request format

const QR = {
  type: 'quickReplies',
  config: {
    textMessages: [{ text: '1st random text' }, {text: '2nd random text' }],
    quickReplies: [
      {
        imageUrl: 'https://www.faviconurl.jpg',
        payload: { nextDialogstateId: '1f51bo05-0510-11e03-0030-1f0d0040sd' },
        title: 'go to button',
        type: 'postback',
      },
    ],
  },
};

Configuration object

Property

type

Description

textMessages

Array

A list of text message objects

quickReplies

Array

A list of quick reply objects

Text message object

Property

type

Description

text

String

A text message

Quick reply object

Property

type

Description

title

String

Title

type

String

Quick reply type: postback / location

payload

Object

The payload object with a next dialog state

imageUrl

String

The quick reply icon url

Payload object

Property

type

Description

nextDialogstateId

String

Redirect the user to this dialog state

params

Array

A list of parameter objects. A parameter object has a key and value property

Carousel

A carousel includes a list of carousel elements.

Request format

const carousel = {
  config: {
    elements: [
      {
        imageUrl: 'https://www.chatlayer.ai/image.jpg',
        subTitle: 'subtitle',
        title: 'title',
        webUrl: 'https://www.chatlayer.ai',
        buttons: [
          {
            type: 'web_url',
            title: 'url button test',
            url: 'https://www.chatlayer.ai',
          },
        ],
      },
    ],
  },
  type: 'carousel',
};

Configuration object

Property

type

Description

elements

Array

A list of carousel elements

Carousel element object

Property

type

Description

title

String

Title

subTitle

String

Subtitle

webUrl

String

The url to redirect the user to when a carousel element is tapped

imageUrl

String

The url of the carousel element image

buttons

Array

A list of buttons

Button object

Property

type

Description

title

String

Title

type

String

Button type: postback / web_url / call

payload (only for type postback and phone_number)

String for type phone_number

Object for type

The button payload. An object with next dialog state and parameter key/value combinations for type postback. A telephone number for type phone_number.

url (only for type web_url)

String

The website url to open

call (only for type phone_number)

String

The phone number to call

Payload object for type postback

Property

type

Description

nextDialogstateId

String

Redirect the user to this dialog state

params

Array

A list of parameter objects. A parameter object has a key and value property

Media

Media supports three types:

  • image

  • video

  • audio

Request format

const media = {
  config: {
    media: {
      type: 'image', //or video, attachment, audio
      url: 'https://www.chatlayer.ai/image.jpg',
    },
  },
  type: 'media',
};

Configuration object

Property

type

Description

media

Media object

A media object

Media object

Property

type

Description

isCache

Boolean

A flag to indicate if the media should be cached for performance optimization.

type

String

The media type: video / audio / image

url

String

The media url

PreviousAdvanced API integrationsNextRetrieving data from Airtable (GET)

Last updated 4 years ago

Was this helpful?