How To Make Connection To Dialogflow API In ReactJS (front-end)
I can't seem to find a solution for this. I'm trying to make a connection to Dialogflow
using ReactJS
.
So far I've tried it by making an Ajax call and using dialogflow.SessionsClient()
with the credentials JSON
file.
I keep getting Authentication errors. Is there any example, because I can't find anything.
Thank you.
Answer
If you want the dialogflow agent to be incorporated into your website you have two ways:
One is to integrate dialogflow SDK with your own website which requires a great deal of coding. Moreover, you need to build your own UI to read and display messages after you call dialogflow API for responses, Which is a tedious process
Another approach is to use some third party tool that offers integration into the Dialogflow. I would suggest kommunicate where you just need to copy the javascript file and add it in your react js component, also you can enable rich text for chat widget with Dialogflow bot in your React JS websites. You can further customise the chat widget to match your website colours and theme. Please check the link for more info
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM