community.general.telegram (1.3.14) — module

module for sending notifications via telegram

Authors: Artem Feofanov (@tyouxa)

Install collection

Install with ansible-galaxy collection install community.general:==1.3.14


Add to requirements.yml

  collections:
    - name: community.general
      version: 1.3.14

Description

Send notifications via telegram bot, to a verified group or user

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

- name: Send a message to chat in playbook
  community.general.telegram:
    token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX'
    chat_id: 000000
    msg: Ansible task finished

Inputs

    
msg:
    description:
    - What message you wish to send.
    required: true
    type: str

token:
    description:
    - Token identifying your telegram bot.
    required: true
    type: str

chat_id:
    description:
    - Telegram group or user chat_id
    required: true
    type: str

msg_format:
    choices:
    - plain
    - markdown
    - html
    default: plain
    description:
    - Message format. Formatting options `markdown` and `html` described in Telegram API
      docs (https://core.telegram.org/bots/api#formatting-options). If option `plain`
      set, message will not be formatted.
    type: str

Outputs

msg:
  description: The message you attempted to send
  returned: success
  sample: Ansible task finished
  type: str
telegram_error:
  description: Error message gotten from Telegram API
  returned: failure
  sample: 'Bad Request: message text is empty'
  type: str