Speak Processor middleware

Description of speak-processor-middleware, in charge of setting and supporting the speak property to the activity in case the channel requires it

Description

The speak-processor-middleware extends BotFramework class OutgoingMessageMiddleware, meaning that certain code is executed on message outgoing.

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

Depending on the configuration of the channel and the value of modality and fullAura.voice in the request channelData, it assures that a speakable sentence is provided in the activity.speak field.

  • If channel.alwaysSpeak is true or activity.channelData.modality is voice or activity.channelData auraMode.fullAura.voice is true, then:

    • If the activity does not have the speak field, then activity.text is processed applying the rules configured in AURA_MIDDLEWARE_SPEAK_PROCESSOR to clean up the text of unwanted characters and make it speakable.

    • If the activity already counts on a speak field, nothing is done.

    • If no rules are configured, nothing is done.

  • Otherwise, speak field is removed from the activity, because the channel will not wait for it.