Botframework-webchat: Text to speech not speaking texts even if it was told to do so in v4

Created on 28 Feb 2019  路  7Comments  路  Source: microsoft/BotFramework-WebChat

Referencing https://github.com/Microsoft/BotFramework-WebChat/issues/1179

Is this still possible in v4? I can't seem to find lastInputViaSpeech in the repository. How do I tell the bot to always speak whatever it is trying to say?

Docs Speech Bot Services Question backlog customer-replied-to customer-reported

Most helpful comment

What's the design reason as to why you only want the bot to speak if microphone was used by the user? To me that's a limiting functionality. I want the bot to speak at a welcome chat or always talk for accessibility issue without having to require the user to speak. What if the user can't talk but requires to hear what the bot is saying?

All 7 comments

lastInputViaSpeech appears to be a Web Chat v3 feature that is no longer compatible with v4. I'm inclined to say this was intentionally removed because the intended action of a bot is to use speech only when spoken to, see Enable Web Chat docs (second paragraph)

However the issue you linked appears to disagree with that. @compulim, do you have input? Have there been changes in the past over how speech bots should function?

What's the design reason as to why you only want the bot to speak if microphone was used by the user? To me that's a limiting functionality. I want the bot to speak at a welcome chat or always talk for accessibility issue without having to require the user to speak. What if the user can't talk but requires to hear what the bot is saying?

@corinagum Could you try out something?

  • Instantiate Web Chat with a custom store
  • Call store.dispatch({ type: 'WEB_CHAT/START_SPEAKING' })
  • And then type echo ABC in Web Chat
  • Verify if the bot is speaking the response, or not

    • If yes, this is the solution

    • If not, we might be disabling speak after the user send the last message via keyboard, and we need to find a better story for this scenario

Hey @leolorenzoluis, @compulim and I had a fun discussion about this today and got this non-recommended workaround code to work: (it's a bit hack-y)

        const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
          console.log(action.type);
          if(action.type === 'DIRECT_LINE/INCOMING_ACTIVITY' && action.payload.activity.from.role !== 'user') {
            // We need to postpone the dispatch because we need to wait until the reducer adds this activity to the store, before we can mark it to be spoken.
            setImmediate(() => {
              store.dispatch({ type: 'WEB_CHAT/MARK_ACTIVITY', payload: { activityID: action.payload.activity.id, name: 'speak', value: true } });
            });
          }
          return next(action);
        });

Meanwhile, we are waiting to continue discussion on whether we want to use channel data to pass customization to Web Chat. This would be a flag indicating that the bot should always speak incoming activities from the bot, regardless if the user begins typing in the sendbox. I'll update this issue again once that discussion has taken place. :)

Although hacky, workaround provided is sufficient for now. Web Chat team would like to discuss this UX with a conversation designer before implementing any code changes.

This is also related to #2211. When we implement the feature, it will fix this issue.

Closing this. Please follow https://github.com/microsoft/BotFramework-WebChat/issues/2211 for updated to this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prashanthsridhar picture prashanthsridhar  路  3Comments

GewoonMaarten picture GewoonMaarten  路  3Comments

AndreMantas picture AndreMantas  路  4Comments

compulim picture compulim  路  3Comments

compulim picture compulim  路  3Comments