Categories:
Batch messages response format
Description of batch messages response format
Introduction
aura-bot has two working modes for sending messages: immediate mode and batch mode, than can be selected by channel configuration.
We can configure aura-bot in immediate or batch mode by channel, in the responseOptions.versions.vX.batchMessages property, where:
vX:channelDataversion (v3forchannelData3.0.0).
Configuring it this way, we are able to send batch messages only in certain channels.
Immediate mode
In immediate mode, when a message is sent by a dialog or middleware, it is sent directly to the user (after executing the outgoing middlewares), without delays.
Batch mode
In batch mode, aura-bot intercepts and stores all the sending messages (after being processed by the outgoing middlewares), and sends them all at once on turn end.
When using batch mode and all the messages are gathered from the bot message queue and processed together to assure that the inputHint is correct in all of them, then the behavior is as follows:
All but the last message is set to ignoringInput, as the specification says, and the last message maintains the status set by the dialog or, if it has not been defined (undefined), is set to acceptingInput.
Note that if a dialog sends a prompt, it is its responsibility to send the proper inputHint, in this case expectingInput.
The activities array may contain messages for multiple channels, we can use the method filterByConversationId that returns activities classified by conversationId. This classification allows setting the inputHint correctly for each channel.
The legacy hasMoreMessages flag in channelData is also set when batch processing the messages, but this flag will disappear in near future.