react-simple-chatbot icon indicating copy to clipboard operation
react-simple-chatbot copied to clipboard

Integrate with Amazon Lex

Open tabrza opened this issue 4 years ago • 0 comments

Describe the bug I'm hoping to use this component to interact with Amazon Lex. Was working with react-chat-widget but it was proving complicated to cache user answers so that they persist across webpages. With this component by putting cache = true, that solves that issue. Could you please advise how to handle 'submits' and resolve with a response from the API?

Code from using react chat widget

class App extends Component {

  componentDidMount(){
    addResponseMessage('Hi there, how can I help you?');
  }

  handleNewUserMessage = async (newMessage) => {
     const response = await Interactions.send("lexbot", newMessage);

     addResponseMessage(response.message);
   };

   render(){

     return (
       <div className="App">
         <Widget
            handleNewUserMessage={this.handleNewUserMessage}
         />
       </div>
     );
   }
}

tabrza avatar Apr 21 '20 10:04 tabrza