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.



If you want the dialogflow agent to be incorporated into your website you have two ways:

  1. 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

  2. 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