- In Telegram
- Create your own bot Start a conversation with @botfather and push "start". Now the bot shows possible options. We create the own bot with
- /newbot insertnamehere mypushbot
- Now, @botfather shows your HTTP-API which you needs later to send messages.
- . Create a new channel (optional) If you don't want to send push messages to an existing channel, you have to create a new one. This channel must be public and the the link to it must also be specified.
- Add bot as channel admin
- Now we have to add a task at Tasker;
- Create or edit an existing task and add a new action actioncategory "network" -> "HTTP Post"
- Server:Port https://api.telegram.org
- Path /botinsertyourAPIhere/sendMessage?chat_id=@channelname&text=This is your text
- (Yes, add bot to your API. And channel name is the link address! Mine was something like t.me/bot_name)
- content type application/x-www-form-urlencoded
curl -i -X GET "https://api.telegram.org/bot[YourKey]/sendMessage?chat_id=[@YourChannelName]&text=[YourText]" curl -i -X GET "https://api.telegram.org/bot336112886:AAH09ZnJx_MQ7-ujt2gKhLtBB0gMbxyiexU/sendMessage?chat_id=@Test2356786532110976&text=test"
Here you can find all options for sendMessage as well as the other possibilities like formatting your text: https://core.telegram.org/bots/api#sendmessage
Oh, and someone posted a howto for private channels: https://www.reddit.com/r/TelegramBots/comments/464t81/some_tips_and_tricks_for_bot_developers/
How to post to private channels with bots?
This "feature" allows you to effectively run your channel and don't hit "X public groups + Y public channels <= 5" limit.
- Create public channel and choose any free nickname;
- Add your bot to channel and make it admin;
- Execute send_message function using any utility you like. I personally recommend Advanced REST client Chrome extention;
- On success, Message object will return. You need to extract chat_id value (must be negative number);
- Convert channel to private;
- Use gained previously chat_id to post to this private channel via bot.