This article describes the steps for integrating your bttn to the Telegram
Messenger (https://telegram.org/). Happy hacking!
1. Create a Telegram bot
Follow these instructions provided by Telegram:
Make sure you store your bot's authentication token in a safe place.
2. Create a Telegram channel using the Telegram mobile app
Important, make sure you create a public channel. Don't worry, you can convert it to a private channel later.
3. Add your bot to your channel
Use the search functionality of the Telegram mobile app to find your bot, click on the bot's avatar, then on the menu icon and finally "Add to group"
4. Use curl to send the first message to your channel
Substitute your bot's authentication token and channelusername in the following curl command and execute it:
curl -v -d 'text=hello world' -d 'chat_id=@CHANNELUSERNAME' \
Make sure your channelusername contains the preceding @-sign and that you include "bot" before your authentication token data.
If everything went ok, you should see the message on your channel and you should see a curl response of the following format:
Store the chat_id value (here -1234567890123) and try executing the curl command again, but this time using the numeric chat_id:
curl -v -d 'text=hello world' -d 'chat_id=-1234567890123' \
If you see another message appear in your channel, then everything works as expected.
5. Optional, make your channel private
If you wish to limit who can send messages to your Telegram channel, then you can make it private. Use the Telegram mobile app to navigate to your channel's settings and change "Channel Type" to private. After this change you must use the numeric chat_id as your channel does not have a @channelusername anymore.
6. Configuring your bttn
Finally we have all the necessary info for configuring the HTTP action to your bttn. Login to my.bt.tn, select the bttn you wish to use and click on the "Action" icon next to it.
Choose "New Action", either "pressed" or "not pressed" mode, and then "HTTP" as the action type.
Fill in the following information, substituting your Telegram bot's authentication token and numeric chat_id:
value: the numeric chat_id
value: the message you wish to send
Note that, as usual, you can use tags in the HTTP arguments. For example the tags <NAME>, <ID> and <DEVICEID> might come handy if you configure multiple bttns to send messages your Telegram channel.
Save your action and you're ready. Now simply press your bttn and watch the messages appear on your Telegram channel!