community / community.general / 2.5.9 / module / telegram module for sending notifications via telegram Authors: Artem Feofanov (@tyouxa), Nikolai Lomov (@lomserman)community.general.telegram (2.5.9) — module
Install with ansible-galaxy collection install community.general:==2.5.9
collections: - name: community.general version: 2.5.9
Send notifications via telegram bot, to a verified group or user.
Also, the user may try to use any other telegram bot API method, if you specify I(api_method) argument.
- name: Send notify to Telegram community.general.telegram: token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX' api_args: chat_id: 000000 parse_mode: "markdown" text: "Your precious application has been deployed: https://example.com" disable_web_page_preview: True disable_notification: True
- name: Forward message to someone community.general.telegram: token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX' api_method: forwardMessage api_args: chat_id: 000000 from_chat_id: 111111 disable_notification: True message_id: '{{ saved_msg_id }}'
- name: Send a message to chat in playbook (deprecated old style) community.general.telegram: token: '9999999:XXXXXXXXXXXXXXXXXXXXXXX' chat_id: 000000 msg: Ansible task finished
msg: description: - (Deprecated) What message you wish to send. type: str token: description: - Token identifying your telegram bot. required: true type: str chat_id: description: - (Deprecated) Telegram group or user chat_id. type: str api_args: description: - Any parameters for the method. - For reference to default method, C(SendMessage), see U(https://core.telegram.org/bots/api#sendmessage). type: dict version_added: 2.0.0 version_added_collection: community.general api_method: default: SendMessage description: - Bot API method. - For reference, see U(https://core.telegram.org/bots/api). type: str version_added: 2.0.0 version_added_collection: community.general msg_format: choices: - plain - markdown - MarkdownV2 - html default: plain description: - (Deprecated) Message format. Formatting options C(markdown), C(MarkdownV2), and C(html) described in Telegram API docs (https://core.telegram.org/bots/api#formatting-options). If option C(plain) set, message will not be formatted. type: str
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