Note
This plugin is part of the community.general collection (version 3.8.1).
You might already have this collection installed if you are using the ansible
package. It is not included in ansible-core
. To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.telegram
.
Parameter | Choices/Defaults | Comments |
---|---|---|
api_args dictionary added in 2.0.0 of community.general | Any parameters for the method. For reference to default method, SendMessage , see https://core.telegram.org/bots/api#sendmessage. | |
api_method string added in 2.0.0 of community.general | Default: "SendMessage" | Bot API method. For reference, see https://core.telegram.org/bots/api. |
chat_id string | (Deprecated) Telegram group or user chat_id. | |
msg string | (Deprecated) What message you wish to send. | |
msg_format string |
| (Deprecated) Message format. Formatting options markdown , MarkdownV2 , 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. |
Note
- 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
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 |
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/telegram_module.html