How to use the react-chat-widget.addResponseMessage function in react-chat-widget

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

github callistusystan / Trippy / src / components / ChatWidget.js View on Github external
handleIfAddLinkOrStandardMessage = (data) => {
    if (data.startsWith("http")) {
      console.log("HERE!");
      // Assume it is a link.
      const tokens = data.split(' ');
      let title = "";
      if (tokens.length > 1) {
        // Can form title.
        title = tokens.slice(1, tokens.length).join(' ');
      } else {
        title = 'Here is a link!';
      }
      const url = tokens[0];
      addLinkSnippet({"title": title, "link": url, "target": url});
    } else {
      addResponseMessage(data);
    }
    if (this.state.toggleOpen) this.state.unread++;
    console.log(this.state.toggleOpen);
  };

react-chat-widget

Chat web widget for React apps

MIT
Latest version published 10 months ago

Package Health Score

61 / 100
Full package analysis

Popular react-chat-widget functions