Skip to content
Back to top
View this page

# WebhookInfo

class telegram.WebhookInfo(url, has_custom_certificate, pending_update_count, last_error_date=None, last_error_message=None, max_connections=None, allowed_updates=None, ip_address=None, last_synchronization_error_date=None, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object represents a Telegram WebhookInfo.

  Contains information about the current status of a webhook.

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `url`, `has_custom_certificate`, `pending_update_count`, `ip_address`, `last_error_date`, `last_error_message`, `max_connections`, `allowed_updates` and `last_synchronization_error_date` are equal.

  Returned In

  `telegram.Bot.get_webhook_info()`

  Changed in version 20.0: `last_synchronization_error_date` is considered as well when comparing objects of this type in terms of equality.

  Parameters:

    - url (`str`) – Webhook URL, may be empty if webhook is not set up.

    - has_custom_certificate (`bool`) – `True`, if a custom certificate was provided for webhook certificate checks.

    - pending_update_count (`int`) – Number of updates awaiting delivery.

    - ip_address (`str`, optional) – Currently used webhook IP address.

    - last_error_date (`datetime.datetime`) –

      Optional. Datetime for the most recent error that happened when trying to deliver an update via webhook.

      Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    - last_error_message (`str`, optional) – Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook.

    - max_connections (`int`, optional) – Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery.

    - allowed_updates (Sequence[`str`], optional) –

      A sequence of update types the bot is subscribed to. Defaults to all update types, except `chat_member`, `message_reaction`, and `message_reaction_count`.

      Changed in version 20.0: Accepts any `collections.abc.Sequence` as input instead of just a list. The input is converted to a tuple.

    - last_synchronization_error_date (`datetime.datetime`, optional) –

      Datetime of the most recent error that happened when trying to synchronize available updates with Telegram datacenters.

      Added in version 20.0.

      Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

  url

    Webhook URL, may be empty if webhook is not set up.

    Type:

      `str`

  has_custom_certificate

    `True`, if a custom certificate was provided for webhook certificate checks.

    Type:

      `bool`

  pending_update_count

    Number of updates awaiting delivery.

    Type:

      `int`

  ip_address

    Optional. Currently used webhook IP address.

    Type:

      `str`

  last_error_date

    Optional. Datetime for the most recent error that happened when trying to deliver an update via webhook.

    Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Type:

      `datetime.datetime`

  last_error_message

    Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook.

    Type:

      `str`

  max_connections

    Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery.

    Type:

      `int`

  allowed_updates

    Optional. A tuple of update types the bot is subscribed to. Defaults to all update types, except `chat_member`, `message_reaction`, and `message_reaction_count`.

    Changed in version 20.0:

    - This attribute is now an immutable tuple.

    - This attribute is now always a tuple, that may be empty.

    Type:

      tuple[`str`]

  last_synchronization_error_date

    Datetime of the most recent error that happened when trying to synchronize available updates with Telegram datacenters.

    Added in version 20.0.

    Changed in version 20.3: The default timezone of the bot is used for localization, which is UTC unless `telegram.ext.Defaults.tzinfo` is used.

    Type:

      `datetime.datetime`, optional

  classmethod de_json(data, bot=None)

    See `telegram.TelegramObject.de_json()`.