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

Reactions


In the J-Graph visual editor, the bot business logic is built upon states. Blocks are the elements which describe the user and bot behavior in the context of states.

Reactions are the actions performed by the bot when the appropriate state is triggered.

JAICP DSL equivalents

All reactions have direct equivalents among JAICP DSL tags. They are converted to these tags when switching from J‑Graph to the source code editor.

Block JAICP DSL tag
Text a
Image * image
Audio * audio
Condition if
elseif
else
Random answer random
Button * buttons
inlineButtons
Transition go
go!
Code script

Reactions marked with * are not available in all channels. Refer to Channel features and restrictions to find out whether the necessary reaction is supported.

Actions form a specific subtype of reactions. In contrast to other blocks, they correspond to JAICP DSL custom tags rather than their regular counterparts.

Blocks

Bot response

Text

The Text block corresponds to one text reply made by the bot. Depending on the channel, this can be either a message in a chat or text transformed to speech using TTS.

Text messages can be formatted using HTML markup. It is supported only by the chat widget, Chat API, and Telegram. In other channels, the user will receive a message without any formatting.

Text

Image

The Image block displays an image in the chat. You can provide a link to an image available online or upload your own.

Image

Audio

The Audio block sends an audio file to the chat. You can provide a link to a file available online or upload your own.

The platform sets several requirements to audio files which can be used in the script. Learn more about the audio file format.

Audio

Logic

Condition

The Condition block allows branching the script to execute different reactions based on some condition.

The condition itself is a JavaScript expression evaluated to true or false. Conditions can contain references to any built-in or globally declared variables, functions, and services.

Learn more about JavaScript in bot scripts

Each condition branch may contain an arbitrary number of reactions, including other Condition blocks. It is advised to keep the branching depth at three levels at most.

Condition

Random answer

The Random answer block allows executing one randomly chosen reaction from a list.

Any reaction can be selected as a random answer option, except for another Random answer or a Condition block.

Random answer

Button

The Button block displays one or several buttons in the chat. Each button can be assigned a text and a select reaction, which determines the DSL tag used for the button:

Setting callback_data sent by selecting inline buttons is not implemented in J-Graph.

Button

Transition

The Transition block switches the context to another state of the script. The transition type determines the bot behavior:

  • Deferred — the transition switches the context, but the target state reactions are not executed. The go DSL tag is used.
  • Immediate — after the transition is made, all target state reactions are executed, including other transitions (if there are any). The go! DSL tag is used.

Transition

Code

The Code block allows writing custom JavaScript code which will be executed in this state.

Code