setWebhook: Set a webhook

View source: R/bot.R

setWebhookR Documentation

Set a webhook

Description

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.

Usage

setWebhook(
  url = NULL,
  certificate = NULL,
  max_connections = 40L,
  allowed_updates = NULL,
  ip_address = NULL,
  drop_pending_updates = FALSE,
  secret_token = NULL
)

Arguments

url

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

certificate

(Optional). Upload your public key certificate so that the root certificate in use can be checked. See Telegram's self-signed guide for details.

max_connections

(Optional). Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.

allowed_updates

(Optional). String or vector of strings with the types of updates you want your bot to receive. For example, specify c("message", "edited_channel_post", "callback_query") to only receive updates of these types. See Update for a complete list of available update types. Specify an empty string to receive all updates regardless of type (default). If not specified, the previous setting will be used.

Please note that this parameter doesn't affect updates created before the call to the get_updates, so unwanted updates may be received for a short period of time.

ip_address

(Optional). The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS.

drop_pending_updates

(Optional). Pass True to drop all pending updates.

secret_token

(Optional). A secret token to be sent in a header X-Telegram-Bot-Api-Secret-Token in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.

Details

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>.

You can also use it's snake_case equivalent set_webhook.


telegram.bot documentation built on Sept. 7, 2022, 5:07 p.m.