Willing to play with Bots? To play with IoT? Curious to combine IoT, Hardware and Bots for magical connected use cases?
Here we propose you a terrific bedrock to build your own Bot, thanks to the blending of two powerful ingredients:
- Telegram Bots (link): Telegram is a messaging system, with a great Bot API. May be the greatest.
- TimeSquAir (link): TimeSquAir is a device enabling the creation of connected use cases without needing specific software development skills: creating IoT scenarios is a piece of cake with TimeSquAir!
- You will build your own Bot usages in record time!
- You will link your Bot to IoT, hardware, sensors, IA, connectivity… ...naturally, without any extra effort..
The only 2 first steps require your attention and 4 minutes of your time. The other ones are just here to get a better understanding of what’s actually going on, if required.
- Build your Bot use case in less than 1 minute!
- Install the TimeSquAir Telegram Bot bedrock in less than 3 minutes
- Get some explanation or details, only if you want!
Step 1: Add a New Bot Use Case / Command
Adding a new Bot use case to the TimeSquAir Telegram Bot Bedrock is a matter of seconds! You won’t need to subscribe to any extra system.
Don’t worry, if you don’t have the TimeSquAir Telegram Bot bedrock yet, getting it up and running is explained in the coming chapter. Here’s the structure of your own Telegram Bot handled by your own TimeSquAir:
- a MQTT input node, which topic is bot/newcommand (where newcommand is the new command!)
- the flow with your desired calculation/activation potentially
- a MQTT output node if you want a feedback on Telegram
The video shows how to add a configurable stopwatch with the command /count and the number of seconds as an argument.
Step 2: Install the Bedrock Recipe
Follow the steps, as shown in the video. And if you don’t have a Telegram Bot yet, don’t worry, it is also shown in the video.
- Copy the flow given in appendix (TimeSquAir Telegram Bot bedrock flow) into your desktop notepad.
- Import it into a TimeSquAir new tab.
- Change the tokens in the “Set Globals” function on top of the flow (the “Bot token” is given by Telegram when you create your Bot, and the “Jedi token” is what you want, but we suggest to take a part of the “Bot token”)
- After activation, launch the flow “Click "Go" to get the MQTT router topic in the Debug panel” to get in the debug panel the specific MQTT
- Change the topic of the MQTT input node of the “Bot’s commands router” with the path copied on the previous point.
- Launch the flow “Launch this flow to link automatically the Telegram commands from your BOT to a MQTT service”.
You’re done! Just deploy this new flow, and your TimeSquAir Telegram Bot bedrock is up and running. The two examples make the following:
- If you type /radio_on it will switch on the Radio Phenix stream on your TimeSquAir, and you can switch it off by typing /radio_off
- If you type /display followed by a message, this message is displayed to your TimeSquAir’s LED panel, and you receive a feedback on Telegram.
Step 3: Annex
You'll find herewith some more explanations on:
- How to create a new Bot on Telegram
- How this bedrock is working
You'll find also the bedrock source code for easy importation on your TimeSquAir!