class_docstr: This hook allows you to post messages to Telegram using the telegram python-telegram-bot library.
  
  The library can be found here: https://github.com/python-telegram-bot/python-telegram-bot
  It accepts both telegram bot API token directly or connection that has telegram bot API token.
  If both supplied, token parameter will be given precedence, otherwise 'password' field in the connection
  from telegram_conn_id will be used.
  chat_id can also be provided in the connection using 'host' field in connection.
  Following is the details of a telegram_connection:
  name: 'telegram-connection-name'
  conn_type: 'http'
  password: 'TELEGRAM_TOKEN'
  host: 'chat_id' (optional)
  Examples:
  .. code-block:: python
  
      # Create hook
      telegram_hook = TelegramHook(telegram_conn_id="telegram_default")
      # or telegram_hook = TelegramHook(telegram_conn_id='telegram_default', chat_id='-1xxx')
      # or telegram_hook = TelegramHook(token='xxx:xxx', chat_id='-1xxx')
  
      # Call method from telegram bot client
      telegram_hook.send_message(None, {"text": "message", "chat_id": "-1xxx"})
      # or telegram_hook.send_message(None', {"text": "message"})
  
  :param telegram_conn_id: connection that optionally has Telegram API token in the password field
  :param token: optional telegram API token
  :param chat_id: optional chat_id of the telegram chat/channel/group
class_docstr_tok: ["This","hook","allows","you","to","post","messages","to","Telegram","using","the","telegram","python-telegram-bot","library",".","The","library","can","be","found","here",":","https",":","\/\/github.com\/python-telegram-bot\/python-telegram-bot","It","accepts","both","telegram","bot","API","token","directly","or","connection","that","has","telegram","bot","API","token",".","If","both","supplied",",","token","parameter","will","be","given","precedence",",","otherwise","'password","'","field","in","the","connection","from","telegram_conn_id","will","be","used",".","chat_id","can","also","be","provided","in","the","connection","using","'host","'","field","in","connection",".","Following","is","the","details","of","a","telegram_connection",":","name",":","'telegram-connection-name'","conn_type",":","'http'","password",":","'TELEGRAM_TOKEN'","host",":","'chat_id","'","(","optional",")","Examples",":","..","code-block",":",":","python","#","Create","hook","telegram_hook","=","TelegramHook","(","telegram_conn_id=","''","telegram_default","''",")","#","or","telegram_hook","=","TelegramHook","(","telegram_conn_id='telegram_default","'",",","chat_id='-1xxx","'",")","#","or","telegram_hook","=","TelegramHook","(","token='xxx",":","xxx","'",",","chat_id='-1xxx","'",")","#","Call","method","from","telegram","bot","client","telegram_hook.send_message","(","None",",","{","``","text","''",":","``","message","''",",","``","chat_id","''",":","``","-1xxx","''","}",")","#","or","telegram_hook.send_message","(","None","'",",","{","``","text","''",":","``","message","''","}",")",":","param","telegram_conn_id",":","connection","that","optionally","has","Telegram","API","token","in","the","password","field",":","param","token",":","optional","telegram","API","token",":","param","chat_id",":","optional","chat_id","of","the","telegram","chat\/channel\/group"]
docstr: Returns the telegram API token.
  
  :param token: telegram API token
  :param telegram_conn_id: telegram connection name
  :return: telegram API token
docstr_tok: ["Returns","the","telegram","API","token",".",":","param","token",":","telegram","API","token",":","param","telegram_conn_id",":","telegram","connection","name",":","return",":","telegram","API","token"]
code: def __get_token(
      self, token: str | None, telegram_conn_id: str | None
  ) -> str:
      """
      Returns the telegram API token.
  
      :param token: telegram API token
      :param telegram_conn_id: telegram connection name
      :return: telegram API token
      """
      if token is not None:
          return token
  
      if telegram_conn_id is not None:
          conn = self.get_connection(telegram_conn_id)
  
          if not conn.password:
              raise AirflowException(
                  "Missing token(password) in Telegram connection"
              )
  
          return conn.password
  
      raise AirflowException(
          "Cannot get token: No valid Telegram connection supplied."
      )
  
file_path: airflow/airflow/providers/telegram/hooks/telegram.py
imports: from __future__ import annotations
  import asyncio
  import telegram
  import tenacity
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
label_desc: Use image node_id 3 for calling the TelegramHook obj's underlying member method code with example usage: obj.__get_token(token, telegram_conn_id) and returns: token, conn