Skip to content

adriankumpf/logger-telegram-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoggerTelegramBackend

Build Status Docs Hex.pm

A logger backend for Telegram.

Installation

Add :logger_telegram_backend and :finch to your list of dependencies in mix.exs:

def deps do
  [
    {:logger_telegram_backend, "~> 3.0"},
    {:finch, "~> 0.16"},
  ]
end

Add the backend

In your Application.start/2 callback, add the LoggerTelegramBackend:

@impl true
def start(_type, _args) do
  LoggerTelegramBackend.attach()

  # ...
end

Add the following to your configuration:

config :logger, LoggerTelegramBackend,
  chat_id: "your_chat_id",
  token: "yout_bot_token"

To create a Telegram bot, see the next section.

Configure the Telegram bot

To create a Telegram bot, follow the instructions here and get the token for the bot.

Then send a message to the bot and get your chat_id:

TOKEN="your_bot_token"
curl https://api.telegram.org/bot$TOKEN/getUpdates

License

This project is Licensed under the MIT License.