Skip to content

Instantly share code, notes, and snippets.

@tekos-flow
Last active December 21, 2020 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tekos-flow/8c12ff2292cad9ab99acd3ea692f1668 to your computer and use it in GitHub Desktop.
Save tekos-flow/8c12ff2292cad9ab99acd3ea692f1668 to your computer and use it in GitHub Desktop.
Dialogflow & Telegram Bot

Easily configure bot on telegram using the google Dialogflow NLP. (https://tekos.co/)

How is it useful:

  • Easily create AI bot
  • Connect Google with Telegram
  • Automate processes

How does it work?

We receive Telegram messages to Tekos Flow, then pass the data to Dialogflow. Dialogflow uses Google AI to select wanted answer.

Dialogflow preparation:

Check out the tutorial on how to get Dialogflow access (CLICK HERE)

Telegram preparation:

Search for @BotFather in Telegram and start to chat.  Type /newbot and follow the steps. You will receive an access token.

How to start with the flow:

Download our JSON file and import it into your project.

1. In Telegram Receiver & Sender set the data as bellow

2. In Dialogflow set the data as bellow

Nicely done:

Once everything is set all you need is to deploy the changes.

Now you can open Telegram chat and start a conversation with your bot.

 

[{"id":"c4c0d03b.91eb1","type":"chatbot-telegram-receive","z":"ea19d9bb.f77718","bot":"491b98a6.3eb3b8","botProduction":"","x":130,"y":240,"wires":[["57fb7b1c.948a54"]]},{"id":"8d45d1a0.ad401","type":"chatbot-telegram-send","z":"ea19d9bb.f77718","bot":"491b98a6.3eb3b8","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":910,"y":240,"wires":[]},{"id":"57fb7b1c.948a54","type":"dialogflowv2","z":"ea19d9bb.f77718","dialogflow":"95f1f9c.778f308","language":"en","debug":false,"variable":"topic","x":360,"y":240,"wires":[["fb4e0f5.acb45f","b79b2be8.2271e8"]]},{"id":"25fcdaac.b3ff66","type":"switch","z":"ea19d9bb.f77718","name":"action","property":"_dialogflow.action","propertyType":"msg","rules":[{"t":"eq","v":"show_menu","vt":"str"},{"t":"eq","v":"give_capabilities","vt":"str"},{"t":"eq","v":"handover_request","vt":"str"},{"t":"eq","v":"invite_to_room","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":230,"y":480,"wires":[["618c65ed.a53e6c"],["2bd80ff2.234c6"],["130136b3.97f1d9"],["da35fb47.ea7148"],["b2f39182.351ee"]]},{"id":"b2f39182.351ee","type":"change","z":"ea19d9bb.f77718","name":"msg","rules":[{"t":"set","p":"payload","pt":"msg","to":"_dialogflow.fulfillmentMessages[0].text.text[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":415,"y":560,"wires":[["5be883d6.bb1c5c"]],"l":false},{"id":"618c65ed.a53e6c","type":"link out","z":"ea19d9bb.f77718","name":"","links":["eefdb4c9.9bd638","33f7fa5c.8a8b96"],"x":415,"y":340,"wires":[]},{"id":"2bd80ff2.234c6","type":"link out","z":"ea19d9bb.f77718","name":"","links":["bafe1309.ead79","fcda4a3b.dab258"],"x":415,"y":398,"wires":[]},{"id":"130136b3.97f1d9","type":"link out","z":"ea19d9bb.f77718","name":"","links":["307a2e8c.dc52b2"],"x":415,"y":440,"wires":[]},{"id":"6ad6a2a4.b4386c","type":"link out","z":"ea19d9bb.f77718","name":"","links":["5dc70f13.28596"],"x":415,"y":522,"wires":[]},{"id":"da35fb47.ea7148","type":"link out","z":"ea19d9bb.f77718","name":"","links":["b3cc5e8b.75542"],"x":415,"y":480,"wires":[]},{"id":"5be883d6.bb1c5c","type":"chatbot-text","z":"ea19d9bb.f77718","name":"fullfillment message","message":[{"message":""}],"x":550,"y":560,"wires":[["439676ce.980b98"]]},{"id":"d5ac3cc2.90165","type":"link in","z":"ea19d9bb.f77718","name":"","links":["439676ce.980b98"],"x":775,"y":240,"wires":[["8d45d1a0.ad401"]]},{"id":"439676ce.980b98","type":"link out","z":"ea19d9bb.f77718","name":"","links":["d5ac3cc2.90165"],"x":695,"y":560,"wires":[]},{"id":"fb4e0f5.acb45f","type":"debug","z":"ea19d9bb.f77718","name":"msg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"b79b2be8.2271e8","type":"link out","z":"ea19d9bb.f77718","name":"","links":["a4f9fe60.f60e8"],"x":525,"y":240,"wires":[]},{"id":"a4f9fe60.f60e8","type":"link in","z":"ea19d9bb.f77718","name":"","links":["b79b2be8.2271e8"],"x":115,"y":480,"wires":[["25fcdaac.b3ff66"]]},{"id":"6c085d71.5732a4","type":"comment","z":"ea19d9bb.f77718","name":"wire to the next action","info":"","x":540,"y":400,"wires":[]},{"id":"33f7fa5c.8a8b96","type":"link in","z":"ea19d9bb.f77718","name":"","links":["618c65ed.a53e6c"],"x":105,"y":680,"wires":[[]]},{"id":"6e036a01.aa7874","type":"comment","z":"ea19d9bb.f77718","name":"Complete your action","info":"","x":260,"y":680,"wires":[]},{"id":"491b98a6.3eb3b8","type":"chatbot-telegram-node","z":"","botname":"@tokoss_bot","usernames":"","providerToken":"","polling":"100","store":"","log":"","debug":false,"webHook":"https://teksa.tekos.co/redbot/telegram","connectMode":"polling"},{"id":"95f1f9c.778f308","type":"dialogflowv2-token","z":"","name":"Tekos Bot AI"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment