Extended Outgoing middleware

Description of extended-outgoing-middleware, that formats the outgoing message

Description

The aim of extended-outgoing-middleware is to properly format the outgoing message with all the common properties needed in Aura’s response. This is an extension of the outgoing-middleware.

This middleware 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 EXTENDED_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

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