Alexia.API (alexia v0.8.1)

Provides basic functionalities for Telegram Bot API.

Link to this section Summary

Link to this section Functions

Link to this function

build_file_url(bot_id, file_path)

Specs

build_file_url(binary(), binary()) :: binary()

Use this function to build file url.

iex> Alexia.API.build_file_url("bot_token","document/file_10") "https://api.telegram.org/file/botbot_token/document/file_10"

Link to this function

request(method, bot_id, options \\ [], file_field \\ nil)

Specs

request(binary(), binary(), [{atom(), any()}], atom()) ::
  :ok | {:error, Alexia.Model.Error.t()} | {:ok, any()}

Generic method to call Telegram Bot API.

Args:

  • method - name of API method
  • bot_token - token of the bot
  • options - orddict of options
  • file_field - specify the key of file_field in options when sending files
Link to this function

request?(method, bot_id, options \\ [], file_field \\ nil)

Link to this function

request_with_token(method, bot_token, options \\ [], file_field \\ nil)