Telegram ChatBot using IBM Watson Conversation
This flow uses TelegramBot node and IBM Watson Conversation
[{"id":"2222bafb.872c86","type":"telegram receiver","z":"a79396ff.3eada","name":"","bot":"5485c65d.c921c8","saveDataDir":"","x":109.375,"y":420.0000305175781,"wires":[["3e0a95af.e5f08a"],["10222f18.29e139"]]},{"id":"3e0a95af.e5f08a","type":"function","z":"a79396ff.3eada","name":"Save context","func":"context.flow.chatId = msg.payload.chatId;\ncontext.flow.type = msg.payload.type;\nmsg.payload = msg.payload.content;\nreturn msg;","outputs":1,"noerr":0,"x":296.875,"y":413.7500305175781,"wires":[["24ebd36b.04d1e4"]]},{"id":"24ebd36b.04d1e4","type":"watson-conversation-v1","z":"a79396ff.3eada","name":"","workspaceid":"e61968ba-db33-4b79-8597-f04f0d4177f8","multiuser":false,"context":true,"empty-payload":false,"default-endpoint":true,"service-endpoint":"https://gateway.watsonplatform.net/conversation/api","x":470,"y":414.0000305175781,"wires":[["3c133c0c.807744"]]},{"id":"3c133c0c.807744","type":"function","z":"a79396ff.3eada","name":"Restore context","func":"msg.payload.chatId = context.flow.chatId;\nmsg.payload.type = context.flow.type;\nmsg.payload.content = msg.payload.output.text[0];\nreturn msg;","outputs":1,"noerr":0,"x":653.375,"y":413.9375305175781,"wires":[["bf4a1e56.e282c"]]},{"id":"bf4a1e56.e282c","type":"telegram sender","z":"a79396ff.3eada","name":"","bot":"5485c65d.c921c8","x":855.125,"y":413.0000305175781,"wires":[[]]},{"id":"10222f18.29e139","type":"function","z":"a79396ff.3eada","name":"Not authorized user","func":"msg.payload.content = \"You're not authorized user\";\nreturn msg;","outputs":1,"noerr":0,"x":508.125,"y":563.4375305175781,"wires":[["bf4a1e56.e282c"]]},{"id":"c61665b5.dc1d8","type":"comment","z":"a79396ff.3eada","name":"Read.me","info":"1) Create a Watson Conversation on IBM Cloud (https://www.bluemix.net)\n2) Create a Telegram Bot:\n Open web.telegram.org\n find BotFather (contact)\n send /newbot\n Give a name for your bot (Botfather will ask it)\n Give a user name for it, which should have in the end \"Bot\"\n The BotFather will give you a token.\n ","x":91.875,"y":374.6875,"wires":[]},{"id":"5485c65d.c921c8","type":"telegram bot","z":"","botname":"JoaoBatistaBot","usernames":"","chatids":""}]