telegram-api-0.7.0.0: Telegram Bot API bindings

Safe HaskellNone
LanguageHaskell2010

Web.Telegram.API.Bot.API.Updates

Contents

Synopsis

Functions

getUpdates Source #

Arguments

:: Token 
-> Maybe Int

offset

-> Maybe Int

limit

-> Maybe Int

timeout

-> Manager 
-> IO (Either ServantError UpdatesResponse) 

Use this method to receive incoming updates using long polling. A list of Update objects is returned. Use getUpdatesM for more features

getUpdatesM' :: TelegramClient UpdatesResponse Source #

Get update with default parameters See getUpdates for details.

setWebhook Source #

Arguments

:: Token 
-> Maybe Text

HTTPS url to send updates to. Use an empty string to remove webhook integration

-> Manager 
-> IO (Either ServantError SetWebhookResponse) 

Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.

If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.

setWebhookWithCertificate :: Token -> SetWebhookRequest -> Manager -> IO (Either ServantError SetWebhookResponse) Source #

Use this method to specify a url and receive incoming updates via an outgoing webhook. Whenever there is an update for the bot, we will send an HTTPS POST request to the specified url, containing a JSON-serialized Update. In case of an unsuccessful request, we will give up after a reasonable amount of attempts.

If you'd like to make sure that the Webhook request comes from Telegram, we recommend using a secret path in the URL, e.g. https://www.example.com/<token>. Since nobody else knows your bot‘s token, you can be pretty sure it’s us.

deleteWebhook :: Token -> Manager -> IO (Either ServantError (Response Bool)) Source #

Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success.

getWebhookInfo :: Token -> Manager -> IO (Either ServantError GetWebhookInfoResponse) Source #

Contains information about the current status of a webhook.

API

type TelegramBotUpdatesAPI = (TelegramToken :> ("getUpdates" :> (ReqBody '[JSON] GetUpdatesRequest :> Get '[JSON] UpdatesResponse))) :<|> ((TelegramToken :> ("setWebhook" :> (ReqBody '[JSON] SetWebhookRequest :> Get '[JSON] SetWebhookResponse))) :<|> ((TelegramToken :> ("setWebhook" :> (MultipartFormDataReqBody SetWebhookRequest :> Post '[JSON] SetWebhookResponse))) :<|> ((TelegramToken :> ("deleteWebhook" :> Post '[JSON] (Response Bool))) :<|> (TelegramToken :> ("getWebhookInfo" :> Get '[JSON] GetWebhookInfoResponse))))) Source #

Telegram Bot API

updatesApi :: Proxy TelegramBotUpdatesAPI Source #

Proxy for Thelegram Bot API to configure your bot