A conversation is an interaction between user and bot, it consists of one incoming message and one or more responses. The system will never send a message to user by itself. Every message coming to the user is triggered by an incoming message. Incoming message can either be triggered a user message, or by systems such as scheduler / broadcaster.
Whenever a conversation is triggered, following workflow is processed:
- Session object will be fetched
Current Flow will be determined
- if not, it will select a flow that has a matching intent
- Intent will be matched and attributes will be processed
Starting from the last state (otherwise initial state), a new state will be determined
- During state transition, context mapping will be executed
Actions of the state will be executed
- Responses are generated by action
- If action contains command, converse will be executed recursively
- Session will be updated
- Responses will be sent
One converse process can produce more than one responses. A response can be one of the following type:
command- A command response type will be fed back to the bot and trigger another converse cycle.
data- A data response type will return a formatted data, such as image, carousel, button etc.
text- A text response type will return a text chat bubble as a response.
A message consists of following definitions:
type: string- Message type (text or data)
content: string- Exist if message type is text
payload: JsonObject- Exist if message type is data
metadata: JsonObject- Metadata for specific channel type
Command allow you to trigger multiple converse cycles. This is useful in many use-cases, such as moving to multiple states for more fluid conversation.