View Categories

Conversation API

18 minutes of reading

1. Introduction #

Bot integration is an optional feature and it can be defined via billing subscription plan. With this feature the automatic responses to the messages received in the Easy Dialog app, can be generated with Botpress, some Custom third-party API or OpenAI-compatible chat completion API. So, when someone sends a message to the Easy Dialog app, if Bot is enabled, they will receive a message back generated by the Bot.

The Conversation API accounts can be managed after selecting the “Conversation API” option from the “Settings” > “Integration” section of the Business Messenger app.

2. Bot Integration Type #

For the Conversation Account, Integration type can be selected to be BotpressCustom or AI.

2.1 Botpress Adapter #

Botpress is an open-source platform for developers to build chatbots. For integration with the Business Messenger app, you need to host Botpress v12 on your own, or you can contact our Sales team for more information about a hosted version on our servers.

2.1.1 Configuration for Botpress API #

In order to configure Botpress in the Business Messenger app, the following data are needed:

Bot ID – The bot ID is given on the botpress dashboard. The bot name is not accepted as a valid value.
Botpress URL – The URL for the botpress server, e.g. http://botpress.com:3000.
Credentials Email – The email that is used for the botpress account.
Credentials Password – The password for the botpress account.

2.1.2 Botpress Inbound #

The Business Messenger Conversation API will send the following inbound messages to Botpress Converse API in the following format:

Message Typeevent.type or event.payload.typeContent FieldContent Description
Texttextevent.payload.textMessage text.
Pictureimageevent.payload.imageURL to the image file.
Audioaudioevent.payload.audioURL to the audio file.
Videovideoevent.payload.videoURL to the video file.
Filefileevent.payload.fileURL to the file.
Locationlocationevent.payload.latitude, event.payload.longitudeLatitude and longitude numbers.
Responseresponseevent.payload.response, event.payload.responseDataevent.payload.response will contain response type: e.g. questionorderform
event.payload.responseData will contain actual response data as javascript object.

2.1.3 Botpress Outbound #

All types of the Botpress outbound messages are supported: text, image, single choice messages, card, carousel, file, video, audio, location, etc.

Also, multi-message responses are supported.

2.2 Custom Adapter #

Integrating the Conversation API via Custom adapter provides most flexibility for automatic message responses while being very simple to understand and implement. The implementer is expected to develop a single webhook endpoint available at a public URL. It will receive all inbound messages as requests and it is expected to respond in the specific format to those requests, which will be processed and forwarded to the end users as automatic message responses.

2.2.1 Configuration for Custom API #

The following data are needed:

Webhook URL – The webhook URL to which POST request will be sent with an inbound message.
Signature – Signature key is a random string for signing and validating requests (it is preferred to be UUIDv4, but it can be anything).

Debug mode can be activated by selecting the “Debug Mode” checkbox located at the bottom of the configuration form in the Custom Adapter settings. It enables error reporting requests to help in identifying issues in bot responses. More details about Debug mode can be found in 2.2.4 Debug Mode section.

For Custom API a lot of different message types are supported for inbound and outbound traffic. Each inbound request data (what we send to the Custom API) is signed with the signature key from a configuration with sha512 algorithm which is base64 encoded. The signature key will be in the request header field [X-BM-Signature]. The exact function for signing a request is this:

This way it is possible to check authenticity of the request.

2.2.2 Inbound Requests #

These requests represent what we send to Custom webhook endpoint. The base format for the request is presented below:

The request contains the following details:

serviceUuid – UUID for the Business Messenger account.
dialogUuid – Internal UUID for Easy Dialog conversation. It can be used to differentiate the conversations.
channel – From which channel the message arrived. Possible channels: SMS, Viber, Telegram, Facebook, Instagram, RCS (RBM).
message – Main JSON object with message data. See Message object definition below.
contact – Object with a contact data from the Business Messenger app. Contact fields without value might be omitted or presented with null value. See Contact object definition below.

2.2.3 Webhook Response #

After the request is received and data is processed, in the response we expect an outbound message that we will send to the user who sent the message. Format supports multiple messages in one response.

JSON examples of a response are presented below:

1. An example of a response with a picture message:

2. An example of a response with a location and a suggestion messages:

3. An example of a response with a card carousel message:

4. An example of a response with a picture message:

Webhook Response contains the following details:

messages – The main array of objects for the responses. It can be an empty array, or there can be more then one message. Each item in the array represents a separate message.
messages.body – Each message must have a body object with the actual Message object.

The received response we’ll transform to one or more messages and send back as a response message. All messages will be presented in the Easy Dialog app conversations.

Custom Webhook endpoint, described in 4. Method Details section of this document, is used for the integration of external systems regarding Inbound and Outbound Traffic. This endpoint should understand our payloads.

2.2.4 Debug Mode #

When debug mode is enabled, in case your response gets rejected by our validation system, the webhook endpoint will get another request containing just error information. You can use this info for troubleshooting. You are not expected to return any specific content on this request. You can return an empty string.

JSON example of an error reporting request is given below.

2.3 AI Adapter #

By selecting the “AI” option for the “Integration Type”, you can select an AI model provider, or you can use a custom URL of an API endpoint, that accepts OpenAI-compatible chat completion requests (Google, Anthropic, xAI (AKA Grok), Mistral AI, DeepSeek, etc.).

In order to configure Bot integration with an AI provider in the Business Messenger app, you have to create an account on an AI provider platform and generate an API key.

Note: Your secret API keys will not be displayed again after you generate them. Store your secret API keys in a secure, private location.

2.3.1 Configuration for AI Adapter #

In the Business Messenger app, visit Settings > Integration > Conversation API page , and click “Add Conversation Account” button.

BM Settings Page

The following actions are needed:

  • In the opened window, add Name and Description for the Conversation account. For Integration Type, select the “AI” option.
  • The Base URL select field allows you to select an AI provider from the list, or you can specify a custom URL of an API endpoint, that accepts OpenAI-compatible chat completion requests. The list includes Google, Anthropic, xAI (AKA Grok), Mistral AI, DeepSeek, etc.
  • Fill in your API Key for the selected AI provider. After you sign up for an account with an AI provider, you have to generate your API key on the AI provider’s platform.
    Note: Store your API keys in a secure private location.
  • Select a Model. The AI models are predefined sets with different capabilities and price points. Detailed information please find on the AI provider’s pages.For example, more info about OpenAI models you can find on OpenAI Models page.
  • Custom Instructions – you can set optionally custom instructions text so that you can tailor AI to better meet your needs. Custom instructions allow you to add preferences or requirements that you would like AI to consider when generating its responses. Note that using “Custom Instructions” parameter, increases billable token usage.
  • History – AI does not have built-in memory of previous conversation replies. The way to simulate this, is to resend a certain number of recent replies on each new request. Note that using “History” parameter, increases billable token usage.
  • Set the Max Tokens – the maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. AI models process text by breaking it down into tokens, which are common sequences of characters found in text. The exact limit of tokens varies by model.
  • Set the Temperature parameter. It controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive.

With these settings saved, the AI bot can be enabled for sending responses in the Easy Dialog app.

3. Method Overview #

Endpoint for Custom adapter for the Conversation API.

POST/your-webhook-endpoint

Custom adapter for the Conversation API.

4. Method Details #

Endpoint for Custom adapter for the Conversation API.

4.1 Custom Webhook Endpoint #

Integrating the Conversation API via Custom adapter provides most flexibility for automatic message responses.

It is expected from a customer to develop a single webhook endpoint available at a public URL. This endpoint should understand our payloads. The endpoint will receive all inbound messages as requests and it should respond in the specific format to those requests, which will be processed and forwarded to the end users as automatic message responses.

Please note that event though we use common payload format, each channel has its own characteristics, features and limitations. Please find details in 6. Channels Features section of this document. When responding, you can either use common denominator of features across all expected channels, or customize your response based on the specific channel of the current request.

POST/your-webhook-endpoint

Custom adapter for the Conversation API.

Method Overview #

The method creates a webhook.

Parameters #
NameTypeDescription
body (required)object (body)Request data.

Request body object example

Responses #
CodeDescriptionLinks
200Webhook created.No links.
Expected Response Example #

Your endpoint is expected to respond to the webhook request with a list of messages if you intend to reply. This is a response payload example which will return 2 messages: a text and a picture message.

5. Data Models #

Data Models define the structure of a JSON document and describe the data related to the Custom webhook endpoint.

5.1 Webhook Request Payload #

WebhookRequestPayload object properties:

NameTypeDescription
serviceUuidstringThe Business Messenger app account UUID.
dialogUuidstringThe Easy Dialog conversation UUID.
channelstringFrom which channel the message was arrived. Possible values: SMS, Viber, Telegram, Facebook, Instagram, RCS (RBM).
messageobjectThe message data. Message object.
contactobjectThe Business Messenger app’s contact data. Contact object.
JSON Example #

5.2 Webhook Response #

Please note that event though we use common payload format, each channel has its own characteristics, features and limitations. Please find details in 6. Channels Features section of this document. When responding, you can either use common denominator of features across all expected channels, or customize your response based on the specific channel of the current request.

WebhookResponse object properties:

NameTypeDescription
messagesarrayIt can contain TextMessage and SuggestionsMessage, and one of:
PictureMessage object,
VideoMessage object,
AudioMessage object,
FileMessage object,
FileListMessage object,
LocationMessage object,
ContactMessage object.
JSON Example #

5.3 Message #

Message object properties:

NameTypeDescription
toarrayAn array of destinations. MessageDestination object.
fromstringSender ID received from a channel.
providerMsgIDstringMessage ID received from a channel.
allowedChannelsarrayAn array of allowed channels. Possible values: sms, facebook, viber, telegram, instagram, gbm.
customarrayAn array of custom values.
bodyobjectThe message body. Possible values:
TextMessage object,
PictureMessage object,
VideoMessage object,
AudioMessage object,
FileMessage object,
FileListMessage object,
LocationMessage object,
ContactMessage object,
SuggestionsMessage object,
CardMessage object,
CardCarouselMessage object.

5.4 Text Message #

TextMessage object properties:

NameTypeDescription
contentstringThe message content.
JSON Example #

5.5 Picture Message #

PictureMessage object properties:

NameTypeDescription
namestringFile name.
urlstringHTTP URL for the media file.
mimeTypestringFile MIME type.
sizeintegerFile size.
thumbnailNamestringThumbnail file name.
thumbnailUrlstringHTTP URL for the thumbnail file.
thumbnailMimeTypestringThumbnail file MIME type.
thumbnailSizeintegerThumbnail file size.
JSON Example #

5.6 Video Message #

VideoMessage object properties:

NameTypeDescription
namestringFile name.
urlstringHTTP URL for the media file.
mimeTypestringFile MIME type.
sizeintegerFile size.
playingLengthintegerFile playing length.
thumbnailNamestringThumbnail file name.
thumbnailUrlstringHTTP URL for the thumbnail file.
thumbnailMimeTypestringThumbnail file MIME type.
thumbnailSizeintegerThumbnail file size.
JSON Example #

5.7 Audio Message #

AudioMessage object properties:

NameTypeDescription
namestringAudio name.
urlstringHTTP URL for the media file.
mimeTypestringFile MIME type.
sizeintegerFile size.
playingLengthintegerFile playing length.
JSON Example #

5.8 Media Message #

MediaMessage object properties:

NameTypeDescription
urlstringHTTP URL for the media file.
thumbnailUrlstringHTTP URL for the thumbnail file.
heightstringMedia file height.

5.9 File Message #

FileMessage object properties:

NameTypeDescription
namestringFile name.
urlstringFile URL.
mimeTypestringFile MIME type.
sizeintegerFile size.
thumbnailNamestringThumbnail file name.
thumbnailUrlstringHTTP URL for the thumbnail file.
thumbnailMimeTypestringThumbnail file MIME type.
thumbnailSizeintegerThumbnail file size.
fileTypestringFile type.
JSON Example #

5.10 File List Message #

FileListMessage object properties:

NameTypeDescription
textstringMessage text.
filesarrayAn array of FileMessage objects.

5.11 Location Message #

LocationMessage object properties:

NameTypeDescription
latitudenumberLatitude.
longitudenumberLongitude.
textstringLocation message text.
urlstringLocation URL.
JSON Example #

5.12 Contact Message #

ContactMessage object properties:

NameTypeDescription
namestringContact’s name.
emailstringContact’s email.
addressstringContact’s address.
phonestringContact’s phone.
JSON Example #

5.13 Suggestions Message #

SuggestionsMessage object properties:

NameTypeDescription
suggestionsarrayAn array of Suggestion object.

5.14 Suggestion #

Suggestion object properties:

NameTypeDescription
textstringText to display for the suggestion.
postbackstringPostback data.
replyWithobjectReplyWithSuggestion object.
openUrlobjectOpenUrlSuggestion object.
dialNumberobjectDialNumberSuggestion object.
composeMessageobjectComposeMessageSuggestion object.
showMapLocationobjectShowMapLocationSuggestion object.
createCalendarEventobjectCreateCalendarEventSuggestion object.

5.15 Reply With Suggestion #

ReplyWithSuggestion object properties:

NameTypeDescription
postbackstringThe message postback.

5.16 Open Url Suggestion #

OpenUrlSuggestion object properties:

NameTypeDescription
urlstringOpen website.

5.17 Dial Number Suggestion #

DialNumberSuggestion object properties:

NameTypeDescription
numberstringA number.

5.18 Compose Message Suggestion #

ComposeMessageSuggestion object properties:

NameTypeDescription
numberstringA number.
teststringA message text.

5.19 Show Map Location Suggestion #

ShowMapLocationSuggestion object properties:

NameTypeDescription
latitudenumberA location latitude.
longitudenumberA location longitude.
labelstringLabel.
urlstringGoogle maps URL.

5.20 Create Calendar Event Suggestion #

CreateCalendarEventSuggestion object properties:

NameTypeDescription
titlestringTitle.
descriptionstringDescription.
startstringStart of the event.
endstringEnd of the event.

5.21 Card Message #

CardMessage object properties:

NameTypeDescription
layoutobjectCard layout.
contentarrayCardMessageContent object.
JSON Example #

CardCarouselMessage object properties:

NameTypeDescription
layoutobjectMessage layout.
contentarrayAn array of CardMessageContent objects.
JSON Example #

5.23 Card Message Content #

CardMessageContent object properties:

NameTypeDescription
mediaobjectMediaMessage object.
titlestringCard message title.
descriptionstringCard message description.
suggestionsarrayAn array of possible values:
ReplyWithSuggestion object,
OpenUrlSuggestion,
DialNumberSuggestion object,
ComposeMessageSuggestion object,
ShowMapLocationSuggestion object,
CreateCalendarEventSuggestion object.

5.24 Message Destination #

MessageDestination object properties:

NameTypeDescription
numberstringDestination as a number.
aliasstringDestination as an alias.

5.25 Contact #

Contact object properties:

Note: Not all Contact fields are required. Contact fields without value might be omitted or presented with null value.

NameTypeDescription
uuidstringContact UUID.
created_dtstring($date‑time)Contact creation date and time, in RFC 3339 format.
updated_dtstring($date‑time)Date and time when a contact is updated, in RFC 3339 format.
opt_statusstringOpt status. Available values: in, out.
opt_status_webpushstringOpt status webpush. Available values: in, out.
first_namestringContact’s first name.
last_namestringContact’s last name.
second_namestringContact’s second name.
nick_namestringContact’s nick name.
genderstringGender of a contact, male or female.
birthdaystringBirthday of a contact, in YYYY-MM-DD format.
salutationstringSalutation.
titlestringTitle.
languagestringLanguage.
nationalitystringNationality,
mobilestringMobile number.
emailstringEmail address.
phonestringPhone number.
faxstringFax number.
addressstringAddress.
zipstringPostal code.
citystringCity.
regionstringRegion.
countrystringCountry.
b_companystringCompany.
b_mobilestringBusiness mobile number.
b_emailstringBusiness email address.
b_faxstringBusiness fax number.
b_phonestringBusiness phone number.
b_addressstringBusiness address.
b_zipstringBusiness address postal code.
b_citystringBusiness address city.
b_regionstringBusiness address region.
b_countrystringBusiness address country.
b_job_titlestringJob title.
b_departmentstringDepartment.
b_reception_codestringReception code.
list_uuidstringList UUID.
channel_namesstringChannel names, in CSV format.
channel_opt_statusstringChannel opt status in CSV format.

6. Channels Features #

Each channel has its own characteristics, features and limitations. When responding, you can either use the common set of features supported across all channels, or tailor your response based on the specific channel of the current request.

6.1 Channels and Message Types #

Depending on the channel used, some message types may not be supported by the Conversation API. The table below shows which message types are compatible with which channel.

Message Type / ChannelSMSWhatsAppRCSTelegramViberFacebookInstagramEmailWeb Push
Text Message
Picture
Audio✓ *✓ *
Video✓ *
File✓ *✓ *
Card✓ *
Carousel✓ *
Contact✓ *✓ *✓ *
Location✓ *✓ *✓ *
Template

* This message type is not natively supported by the channel, but it’s rather emulated using other message types.

6.2 Channels and Button Types #

Depending on the channel used, some button types may not be supported. The table below shows which button types are compatible with which channel.

Button Type / ChannelSMSWhatsAppRCSTelegramViberFacebookInstagramEmailWeb Push
Reply✓ [2]
URL✓ [1]✓ [3]
Dial
Compose
Location✓ [4]✓ [4]✓ [4]✓ [4]
Calendar

[1] only for templates, 2 buttons max.
[2] not possible in carousel.
[3] emulated in carousel.
[4] emulated as URL.

6.3 Channels Features Limitation #

The table below shows the channels features limitation regarding maximum text length, maximum file size, supported file types, etc.

Feature / ChannelSMSWhatsAppRCSTelegramViberFacebookInstagramEmailWeb Push
Max Text Length918 (GSM characters) or 402 (UCS characters)4096only 1024 if buttons are present3072409640962000only 640 if buttons are present1000
Max Image Size (bytes)26214400104857600524288031457282621440026214400
Max Thumb Image Size (bytes)102400204800102400
Max Video Size (bytes)1677721610485760020971520272629762621440026214400
Max Audio Size (bytes)1677721610485760020971520524288002621440026214400
Max File Size (bytes)10485760010485760020971520524288002621440026214400
Max Card File (img) Size (bytes)524288010485760052428805120002621440026214400
Max Buttons in a Card34233
Max Card Title Length602002568080
Max Card Description Length102420001024 title+desc+btn txt5128080
Max Cards in Carousel111061010
Max Button Caption Length2025502020
Supported Image File Typespng (image/png)jpg (image/jpg)jpeg (image/jpeg)png (image/png)jpg (image/jpg)jpeg (image/jpeg)gif (image/gif)png (image/png)jpg (image/jpg)jpeg (image/jpeg)png (image/png)jpg (image/jpg)jpeg (image/jpeg)gif (image/gif)png (image/png)jpg (image/jpg)jpeg (image/jpeg)gif (image/gif)png (image/png)jpg (image/jpg)jpeg (image/jpeg)gif (image/gif)
Supported Video File Typesmp4 (video/mp4)3gp (video/3gp)