Telegram's Bot API wrapper.
- Support for multiple bots
- Configurable HTTP client
- No application configuration
- Add the dependencies
def deps do
[
{:finch, "~> 0.5"},
{:telegramex, "~> 0.1.1"}
]
end
- Add the finch client to your supervision tree
children = [
{Finch, name: Telegramex.HTTPClient}
]
Note: Checkout the Telegramex.Client
on how to use other HTTP client.
- Make a request
client = %Telegramex.Client{token: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"}
Telegramex.get_updates(client)
Full documentation can be found at https://hexdocs.pm/telegramex.
Telegramex executes the following events:
-
[:telegramex, :call, :start]
- Executed before calling the Telegram Bot API.:system_time
- The system time
:method
- The Telegram Bot API method call:body
- The body of the API call
-
[:telegramex, :call, :stop]
- Executed after a API call.:duration
- Duration of the API call.
:method
- The Telegram Bot API method call:body
- The body of the API call:response
- (optional) In case of success (status 200), the response of the api as returned by the HTTP client.:error
- (optional) In case of a error, returns the error.
-
[:telegramex, :call, :exception]
- Executed if the API call raises an exception.:duration
- The time it took before raising an exception
:method
- The Telegram Bot API method call:body
- The body of the API call:kind
- The type of exception.:error
- Error description or error data.:stacktrace
- The stacktrace
See the changelog.
See the contributing file.