How to use the botframework-webchat.createDirectLine function in botframework-webchat

To help you get started, we’ve selected a few botframework-webchat 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-Emulator / packages / app / client / src / ui / editor / emulator / emulator.tsx View on Github external
initConversation(props: EmulatorProps, options: any): void {
    const encodedOptions = encode(JSON.stringify(options));

    // TODO: We need to use encoded token because we need to pass both endpoint ID and conversation ID
    //       We should think about a better model to pass conversation ID from Web Chat to emulator core
    const directLine = createDirectLine({
      secret: encodedOptions,
      domain: `${this.props.url}/v3/directline`,
      webSocket: false,
    });

    this.props.newConversation(props.documentId, {
      conversationId: options.conversationId,
      // webChatStore,
      directLine,
      userId: options.userId,
      mode: options.mode,
    });
  }
github microsoft / BotFramework-WebChat / samples / 21.customization-plain-ui / src / App.js View on Github external
    getDirectLineToken().then(token => setDirectLine(createDirectLine({ token })));
  }
github microsoft / BotFramework-WebChat / samples / 17.a.chat-send-history / src / WebChat.js View on Github external
this.setState(() => ({
      directLine: createDirectLine({ token })
    }));
  }
github microsoft / BotFramework-WebChat / samples / 13.a.customization-speech-ui / src / App.js View on Github external
this.setState(() => ({
      directLine: createDirectLine({
        token
      }),
      webSpeechPonyfillFactory
    }));
  }
github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat / chat.spec.tsx View on Github external
),
  ipcRenderer: new Proxy(
    {},
    {
      get(): any {
        return () => ({});
      },
      has() {
        return true;
      },
    }
  ),
}));

const defaultDocument = {
  directLine: createDirectLine({
    secret: '1234',
    domain: 'http://localhost/v3/directline',
    webSocket: false,
  }),
  inspectorObjects: [],
  botId: '456',
  mode: 'livechat',
};

const mockStore = createStore(combineReducers({ bot, chat, clientAwareSettings, editor }), {
  chat: {
    chats: {
      doc1: defaultDocument,
    },
    pendingSpeechTokenRetrieval: false,
    webChatStores: {},