Error tracking and reporting to a Telegram chat (group or channel) using Tower.
It is a work-in-progress heavily inspired in the already existing TowerEmail
structure, but using Telegram and telegex
.
In order to use this reporter you must have a Telegram bot and provide your bot token and the chat ID (group or channel) in which you need to receive the reports.
If you don't have or you don't know how to create a Telegram bot, first check How Do I Create a Bot Telegram's page.
This reporter uses Telegex
for the communication with the bot. In order to use a Telegram bot, it is necessary
to specify the bot token for Telegex
:
config :telegex, token: "<BOT_TOKEN>"
In addition you must specify your preferred adapter for the HTTP client. At the moment of writting this, Telegex
supports Finch
(recommended) and HTTPoison
:
# With Finch
config :telegex, caller_adapter: Finch
# With HTTPoison
config :telegex, caller_adapter: HTTPoison
Check Telegex's Configuration section for more options and information.
You must also add the chat_id
in which you want to receive the reports:
config :tower_telegram, chat_id: <chat_id>
Finally, you must register the reporter in tower
reporters list:
config :tower, :reporters, [TowerTelegram]
If you are interested in use TowerTelegram but with another Telegram packages, please, first read this issue and then feel free to open a new one requesting! Or even a pull request implementing the one you desire.
Once you already have the reporter, it will listen the errors
of your application as it is explained in Tower
documentation.
It is also possible to manually fire the reporter, check Manual Handling section of Tower's documentation.
Once you have TowerTelegram
configured, you can open iex
and
test it using Tower.test/0
.