This site is no longer updated.Go to new Conversational Cloud docs

Bot replies


You can use JAICP to transmit various bot replies in a uniform format, such as images or buttons. The replies transmitted will then be converted to the channel-specific format.

You can also use DSL tags or methods from the $reactions built-in service to generate bot replies.

Generating bot replies

Bot replies are generated via the $response variable. All replies are added to the $response.replies array. To add a new reply, you need to call the push method.

Before adding a new reply in the array, you need to initialize the replies field in the $response variable. If the field is not initialized, the $response.replies value will be undefined. In this case, when the bot starts executing its reactions, the following error will be returned: Cannot read property “push” from undefined.

Therefore, if the replies field was initialized earlier (the state already has reactions called via DSL tags or built-in methods), assign the same value to it. Otherwise, assign an empty array.

var reply = {"type": "telegramPayment"};
// Reply properties initialization.
// ...
// Reply array initialization.
$response.replies = $response.replies || [];
$response.replies.push(reply);

Restrictions

  1. One bot response can contain no more than 100 elements in the $response.replies array. Their total length cannot exceed 50,000 characters.

  2. Bot replies are specific to each channel: a channel can have a number of its own restrictions on the passed properties or not support the reply type at all. Each article lists the channels that support a particular reply type. You can also refer to the Channel features and restrictions article to find out what restrictions some channels have on the selected reply type.

Reply types

The platform supports the following reply types:

Type Description
audio Send an audio recording.
buttons Display a button.
carousel Display a list of elements to select one of them.
context-switch
context-return
Switch and return the dialog context from one bot to another.
crmIntegration Integration with the Bitrix24 CRM system.
dtmf Request a DTMF message from the user (numbers and letters in the tone mode). Telephone channel only.
file Send a file.
hangup Abort a call. Telephone channel only.
htmlResponse Output the visual component for the skills created using the Interactive Canvas.
image Send an image.
inlineButtons Display an inline button.
location Send coordinates.
raw Can be used to transmit channel-specific methods.
sms Send an SMS message.
switch Switch the conversation from the bot to an agent.
text A simple text response; each response is output as a single message.
telegramPayment Send a payment form for services or goods in Telegram.
telegramPaymentPrecheckout Check the goods availability before checkout.
timeout Configure switching to a certain state if there is no response from the user.
video Send a video.