Telegram Alerts Integration
In Telegram¶
1. Setup your Telegram client and start chatting with a user named BotFather. This is a place where you can create your bot. Just type in:
/newbot
And in the next line type your bot name, e.g., SematextNotificationBot.
Finally, type the bot username, it has to end with the _bot suffix, e.g., SematextNotificationBot_bot.
If everything went successfully you should get a message with the Bot Token API key:
Copy the Bot Token API key somewhere, you will need it to configure the notification hook in Sematext.
2. Invite the bot to the channel to which it should send notifications. You can do that by including the bot in the administrators of the channel in your Telegram client. Let's follow the steps.
First, message the bot using the Telegram client of your choice:
Next, click the channel name:
Click the Administrators to list the channel administrators:
Click the Add Admin button:
Find the created bot and click on it:
Finally, review the permissions and click done:
3. Retrieve the channel identifier for the channel where the bot will send notifications. This can be done by running the following request:
curl -s -k https://api.telegram.org/bot<BOT_TOKEN_API_KEY>/getUpdates
Just replace the
{"ok":true,"result":[{"update_id":878583440, "channel_post":{"message_id":2,"chat":{"id":-1001236826225,"title":"SematextNotifications","type":"channel"},"date":1598380548,"text":"Test test"}}]}
If the response is empty, just send a simple message to the channel you invited the bot to and re-run the request. We are interested in the chat identifier, so the -1001236826225 value from the above response. Note it down.
We are now ready to add our Telegram notification hook to Sematext.
In Sematext¶
1. Navigate to Notification Hooks (in EU) and select Telegram card to create a new Telegram notification hook.
2. Add your Telegram bot token and chat identifier.
Next, click the Send Test Notification button. Telegram should return status code 200 indicating everything is configured correctly. Check your Telegram channel for the test message from Sematext.
Once the test message, is visible click the Save Notification Hook button to save your configuration.