Enrique Vargas
Enrique Vargas

Reputation: 159

How to integrate Dialogflow with Django (Python)?

I'm developing an assistant (bot) with Dialogflow, and i have this Django project where I have to extract data and then expose it through the bot, this is going to be stored in a local platform.

I worked with Dialogflow and it's integration before but with Node.js and Javascript, with Django (python) is a brand new challenge and I'm confused.

Until now I have the following:

And that's all I don't know how to proceed after this, I'm blocked and I don't know how yto make the integration and what's missing, any recommendations?

Upvotes: 2

Views: 3447

Answers (1)

Onk_r
Onk_r

Reputation: 846

Steps

  • Make one html file for your chatbot UI by rendering it with one url-endpoint and view for displaying purpose of your html file say bot.html.
  • For dialogflow I first suggest you to build a dialogflow agent as per you requirement.
  • for webhook of agent provided by your djangoserver which is routed with localtunnel's public IP (for developement purpose use localtunnel like ngrok to your django's server)
  • then add this link to fulfillment of agent.

Hey you can refer this LINK using that you just need to

  • Create one url-endpoint and view say /chatbot which will accepts your text send by bot by AJAX request. This text is then passes to parameter texts in that above functions in link. But make some changes in that functions like without printing fulfillment text just return it.
  • Then in above url-endpoint /chatbot return the response as fulfillmentText return by that function in link.
  • If you wanna use some data of your databases then you can create django-models as tables in normal database, for that check the models - docs. then you can access data by using models.objects.all() etc.

Upvotes: 3

Related Questions