How to use the botframework-webchat-core.sendMessage function in botframework-webchat-core

To help you get started, we’ve selected a few botframework-webchat-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-WebChat / packages / component / src / Middleware / CardAction / createCoreMiddleware.js View on Github external
return ({ dispatch }) => next => ({ cardAction, getSignInUrl }) => {
    const { displayText, text, type, value } = cardAction;

    switch (type) {
      case 'imBack':
        if (typeof value === 'string') {
          // TODO: [P4] Instead of calling dispatch, we should move to dispatchers instead for completeness
          dispatch(sendMessage(value, 'imBack'));
        } else {
          throw new Error('cannot send "imBack" with a non-string value');
        }

        break;

      case 'messageBack':
        dispatch(sendMessageBack(value, text, displayText));

        break;

      case 'postBack':
        dispatch(sendPostBack(value));

        break;