Bot while using Cognitive Speech Services speaks even if the 'speak' field is not present.
Version : 4.11
Even If the 'speak' field is not sent, the bot speaks while using Cognitive Speech Services. There should be an option to tell the webchat not to speak certain messages.

Expected behavior
The bot should not speak when the 'speak' tag is not present.
Additional context
Cannot send an empty string/space to tell the bot because of https://github.com/microsoft/BotFramework-WebChat/issues/3780 [Bug]
@collegewap, you can control the flow of spoken activities via Web Chat's store by dispatching either the WEB_CHAT/START_SPEAKING or WEB_CHAT/STOP_SPEAKING action according to the incoming activity from the bot.
Using the 03.welcome-users sample in the below example, I am simply matching on the text and turning off speech for the associated activities. If the text doesn't match, then the activity is spoken. The result is the second and fifth activities pass silently while the others are spoken.
This example is a crude implementation for illustration only. A better option is to send a flag of some variety in the channelData property of the activity that you can then filter on in the store, or something similar.
const store = window.WebChat.createStore( {}, ( { dispatch } ) => next => action => {
switch ( action.type ) {
case 'DIRECT_LINE/INCOMING_ACTIVITY':
const { activity } = action.payload;
console.log( 'INCOMING_ACTIVITY ', activity );
if (activity.text.startsWith('You are seeing this message')) {
dispatch( {
type: 'WEB_CHAT/STOP_SPEAKING'
} )
} else {
dispatch( {
type: 'WEB_CHAT/START_SPEAKING'
} )
}
break;
}
next( action );
} );
I am closing this as this solution should work for you. Please feel free to re-open if this doesn't meet your needs.
reopening as feature request: 'SKIP_SPEAKING'
Yes, this is a new feature.
According to the spec:
Senders intending that speech should not be generated SHOULD use this value (quoted, and escaped as required) as the content in the speak field:
<speak version="1.0" xmlns="https://www.w3.org/2001/10/synthesis" xml:lang="en-US" />
Although this string is hardcoded, we should check if it's a self-closing root SSML <speak> element instead:
- If the XML has namespace of SSML, and
- it is a root element of tag
speak, and - it is self-closing,
- then skip synthesizing it
We should implement this logic.