W3cubDocs

/Ansible 2.10

community.general.telegram – module for sending notifications via telegram

Note

This plugin is part of the community.general collection.

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.telegram.

Synopsis

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

Parameters

Parameter Choices/Defaults Comments
chat_id
string / required
Telegram group or user chat_id
msg
string / required
What message you wish to send.
msg_format
string
    Choices:
  • plain
  • markdown
  • html
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.
token
string / required
Token identifying your telegram bot.

Notes

Note

  • You will require a telegram account and create telegram bot to use this module.

Examples

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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
msg
string
success
The message you attempted to send

Sample:
Ansible task finished
telegram_error
string
failure
Error message gotten from Telegram API

Sample:
Bad Request: message text is empty


Authors

  • Artem Feofanov (@tyouxa)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/telegram_module.html