Google Dialogflow is Google’s platform for natural language understanding. With the help of this platform, it is easy to create a chat bot capable of answering many questions and working within all sorts of scenarios. For example, answering questions asked in an online store or managing a smart home by receiving commands in natural language.
Through the Dialogflow control console, you can integrate your project into various instant messengers such as Skype, Twitter, Facebook, Telegram and others directly from the control panel. I will show you another way to integrate the dialog flow agent into your telegram bot. To do this, we modify our echo bot.

So:

pip install google-cloud-dialogflow

Go to https://dialogflow.cloud.google.com/. Create a new agent.

Then you need to get the key in the form of a json file. To do this, follow the instructions https://cloud.google.com/dialogflow/es/docs/quick/setup.

Now we have a new agent in DialogFlow and we have a key to it. Bot code below under the spoiler.

Dialogue with a Telegram bot using Dialogflow

It is good to set the Dialogflow on the “first line of defense” of your chat bot to answer general questions such as “What is your name?”, “Who can you do?”, “Who created you?” etc. Also, Dialogflow does a good job of detecting user intentions and finding named entities in a request. In the nearest future I will tell you how it can be used.

29

 

Leave a Reply