community.general.telegram module – Send notifications via telegram
Note
This module is part of the community.general collection (version 9.5.0).
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
.
Synopsis
- 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
api_method
argument.
Parameters
Parameter | Comments |
---|---|
api_args dictionary added in community.general 2.0.0 | Any parameters for the method. For reference to default method, |
api_method string added in community.general 2.0.0 | |
token string / required | Token identifying your telegram bot. |
Attributes
Attribute | Support | Description |
---|---|---|
check_mode | Support: full | Can run in |
diff_mode | Support: none | Will return details on what has changed (or possibly needs changing in |
Notes
Note
- You will require a telegram account and create telegram bot to use this module.
Examples
- 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 }}'
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
---|---|
msg string | The message you attempted to send Returned: success Sample: |
telegram_error string | Error message gotten from Telegram API Returned: failure Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/general/telegram_module.html