To receive notifications in a private channel, a group, or directly to your own account, you will need to create your own bot. Follow the instructions below to create a bot, and then retrieve the Telegram "chat_id" for the target of your notifications.


Creating a bot

In Telegram, start a new chat with @BotFather. Creating a new bot is as simple as sending @BotFather the "/newbot" command. @BotFather will then ask you a few questions about naming your bot, etc. Your bots' name can be just about anything you want, but the username is limited to 5-32 alphanumeric characters (including underscore) in length. It is case insensitive, and the username must end in 'bot'. Once done, @BotFather will provide you with a token to be used for your bot, which will look something like 123456789:AAHR05Xu1-n6ijmHoAyFnbkupn2nX-_BXYZ. Take note of this (it will stay in your Telegram history unless you clear it).


If you're not concerned about your IRIS notifications channel being private, you can skip the rest of the instructions below. All you need do to receive notifications is to provide your bots' token and the channel name in the @channel format when configuring your notification group. Continue reading if you're wanting to use a private channel - the instructions below can be similarly applied to groups (where other members are allowed to speak) and private messages (just you and your bot).


Retrieving the chat_id for a channel

To retrieve the "chat_id" for a channel, you will need to invite your bot to the channel into which you prefer notifications to be sent. You then need to send a message as your bot to the channel, and then retrieve the "chat_id" using 'curl' (be sure to replace [BOT_TOKEN] with the token @BotFather gave you and [CHANNEL] with the name of your channel - be sure to keep the @ prefix in place)

NB: I've piped the output from curl through 'jq' to format the JSON, if you don't have 'jq', just omit the "'| jq .")

 meh:~$ curl -s -X POST "https://api.telegram.org/bot[BOT_TOKEN]/sendMessage" -d text="A message from your bot" -d chat_id="@[CHANNEL]" | jq .
  {
 "ok": true,
 "result": {
   "message_id": 3,
   "chat": {
     "id": -1234567898765,
     "title": "iristestbotchannel",
     "username": "iristestbotchannel",
     "type": "channel"
   },
   "date": 1458136094,
   "text": "A message from your bot"
 }
  }


In the above output you'll see the chat ID "-1234567898765". For future submissions of messages, substitute the "@channel" format of the channel name with this "chat_id" value. This will allow you to make the channel private and rename the channel, including using hyphens in the channels' name. Once your bot and channel have both been setup, add the channel ID retrieved above and your bot's token (as @BotFather gave it to you) to the IRIS Notification Groups configuration.

For more information on Telegram Bots, visit Bots: An introduction for developers