Outgoing middleware

Description of outgoing-middleware, that formats the outgoing message

Description

The outgoing-middleware properly formats the outgoing message with all the common properties needed in an Aura’s response.

The source code of this middleware is included in Aura Bot Platform middlewares - Github repository.

It extends the BotFramework class OutgoingMessageMiddleware, meaning that certain code is executed on message outgoing.

  1. Firstly, it sets the correlator in activity.channelData.correlator.

  2. Then, it sends the outgoing MESSAGE entity row to the KPI handler.

  3. Then, it updates Aura Context with the last information of the message processing.

  4. If there is any error both during these steps or in any other step, that would be stored in the TurnContext, it would be properly added to the activity.channelData. Any activity with an error would contain:

    • The error text as activity.text.

    • As activity.speak, the already set activity.speak or activity.text.

    • activity.inputHint=acceptingInput

    • activity.channelData.hasMoreMessages = false