From The World according to Vissie
Jump to navigation Jump to search




  1. In Telegram
    1. Create your own bot Start a conversation with @botfather and push "start". Now the bot shows possible options. We create the own bot with
    2. /newbot insertnamehere mypushbot
    3. Now, @botfather shows your HTTP-API which you needs later to send messages.
      1. . 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.
    4. Add bot as channel admin
  2. Now we have to add a task at Tasker;
    1. Create or edit an existing task and add a new action actioncategory "network" -> "HTTP Post"
    2. Server:Port https://api.telegram.org
    3. Path /botinsertyourAPIhere/sendMessage?chat_id=@channelname&text=This is your text
      1. (Yes, add bot to your API. And channel name is the link address! Mine was something like t.me/bot_name)
    4. 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.

  1. Create public channel and choose any free nickname;
  2. Add your bot to channel and make it admin;
  3. Execute send_message function using any utility you like. I personally recommend Advanced REST client Chrome extention;
  4. On success, Message object will return. You need to extract chat_id value (must be negative number);
  5. Convert channel to private;
  6. Use gained previously chat_id to post to this private channel via bot.