Generative AI Assistant on Telegram using WatsonX.ai

In this flow you'll make available a Generative AI assistant on Telegram using WatsonX.ai on IBM Cloud.

[{"id":"da9721002b22a01f","type":"watsonx.ai","z":"9519754c74b012cd","name":"WatsonX","apikey":"u_GM-1qreN3Bk5WqPf-dGv98dgXb-YO0ODHD-WEXRbaI","project_id":"44410c5c-d735-43f1-be36-94bd31f8a9ec","model_id":"meta-llama/llama-2-70b-chat","only_firstline":false,"x":560,"y":120,"wires":[["3c133c0c.807744","f5b559bfedb8ce85"]]},{"id":"3e0a95af.e5f08a","type":"function","z":"9519754c74b012cd","name":"Save context","func":"flow.set(\"chatId\", msg.payload.chatId);\nflow.set(\"type\",msg.payload.type);\nmsg.payload = msg.payload.content;\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":120,"wires":[["da9721002b22a01f"]]},{"id":"3c133c0c.807744","type":"function","z":"9519754c74b012cd","name":"Restore context","func":"msg.payload = {\"chatId\": flow.get(\"chatId\"),\n               \"type\": flow.get(\"type\"),\n               \"content\": msg.payload};\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":760,"y":120,"wires":[["106e3553196519f9"]]},{"id":"c61665b5.dc1d8","type":"comment","z":"9519754c74b012cd","name":"Read.me","info":"1) Create a Watson Studio intance on IBM Cloud (https://cloud.ibm.com/catalog/services/watson-studio?catalog_query=aHR0cHM6Ly9jbG91ZC5pYm0uY29tL2NhdGFsb2c%2FY2F0ZWdvcnk9YWk%3D)\n2) Create an instance of Watson Machine Learning;\n3) Crate an APiKey of IBM Cloud Services (copy ans store to future use)\n4) Open Watson Studio, and launch WatsonX perspective\n5) Create a projetct on WatsonX\n6) Go to \"Manage\" tab, and get project id (Save it for future use)\n7) 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 (Save it for future use).\n8) In manage palete, install node-red-contrib-telegrambot, \n   and setup a telegram node with the token gave by BotFather in \n   previously step\n9) In manage palete install watsonx node, and configure it with:\n   APIKey created in previous steps\n   Project ID save it from watsonx platform\n   Model id from the list of model available on watsonx.ai\n\nGood lucky and enjoy your assistant on telegram.   ","x":180,"y":120,"wires":[]},{"id":"fe94e8a123af9817","type":"telegram receiver","z":"9519754c74b012cd","name":"","bot":"15f92a8235375ec0","saveDataDir":"","filterCommands":false,"x":160,"y":180,"wires":[["3e0a95af.e5f08a"],[]]},{"id":"106e3553196519f9","type":"telegram sender","z":"9519754c74b012cd","name":"","bot":"15f92a8235375ec0","haserroroutput":false,"outputs":1,"x":1040,"y":120,"wires":[[]]},{"id":"f5b559bfedb8ce85","type":"debug","z":"9519754c74b012cd","name":"debug 16","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":980,"y":300,"wires":[]},{"id":"15f92a8235375ec0","type":"telegram bot","botname":"SergioGama_AI_bot","usernames":"","chatids":"","baseapiurl":"","testenvironment":false,"updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksprotocol":"socks5","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

Flow Info

Created 10 months, 3 weeks ago
Rating: 1 1

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • debug (x1)
  • function (x2)
Other

Tags

  • WatsonX.ai
  • Telegram
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option