Magik.TelegramNoti (Magik v0.3.0) View Source

This module provide some helper functions that help to send message to a telegram conversation

Config

config :magik, :telegram_noti,
    bot_token: "your bot token".
    conversations: [
          default: "default_chat_id",
          admin: "other chat id"
      ],
    mode: :prod # or :dev
  • conversations is a keyword list with name and chat_id
  • mode: :prod or :dev is used in TelegramNoti Plug, if mode == :dev then reraise the error and return error stacktrace to client side. If mode == :prod then do not return error stacktrace.

Link to this section Summary

Link to this section Functions

Link to this function

send_conn_error(conversation \\ :default, conn, map)

View Source
Link to this function

send_error(conversation \\ :default, title, args \\ nil, map)

View Source
Link to this function

send_message(conversation \\ :default, message)

View Source
Link to this macro

watch(opts \\ [], list)

View Source (macro)

Watch a function and send notification to conversation if an exception occurs

Options

  • to: conversation name
  • args: argument list that passed to function, this is sent to telegram chat for dev to debug easier
  • label: Label for this error/function

Example

...
def do_something(args) do

end
...