PARALLAX

discord

Send messages through Discord webhooks

Collection: community.general

Full Name: community.general.discord

Synopsis

Send messages through Discord webhooks

Parameters

NameTypeRequiredDefaultDescription
avatar_urlstringOverrides the default avatar of the webhook.
contentstringContent of the message to the Discord channel. At least one of O(content) and O(embeds) must be specified.
embedslistSend messages as Embeds to the Discord channel. Embeds can have a colored border, embedded images, text fields and more. Allowed parameters are described in the Discord Docs: U(https://discord.com/developers/docs/resources/channel#embed-object). At least one of O(content) and O(embeds) must be specified.
ttsboolfalseSet this to V(true) if this is a TTS (Text to Speech) message.
usernamestringOverrides the default username of the webhook.
webhook_idstringyesThe webhook ID. Format from Discord webhook URL: C(/webhooks/{webhook.id}/{webhook.token}).
webhook_tokenstringyesThe webhook token. Format from Discord webhook URL: C(/webhooks/{webhook.id}/{webhook.token}).

Example

yaml
- name: Send a message to the Discord channel
  community.general.discord:
    webhook_id: "00000"
    webhook_token: "XXXYYY"
    content: "This is a message from ansible"

- name: Send a message to the Discord channel with specific username and avatar
  community.general.discord:
    webhook_id: "00000"
    webhook_token: "XXXYYY"
    content: "This is a message from ansible"
    username: Ansible
    avatar_url: "https://docs.ansible.com/favicon/favicon-32x32.png"

- name: Send a embedded message to the Discord channel
  community.general.discord:
    webhook_id: "00000"
    webhook_token: "XXXYYY"
    embeds:
        - title: "Embedded message"
          description: "This is an embedded message"
          footer:
            text: "Author: Ansible"
          image:
            url: "https://docs.ansible.com/favicon/favicon-32x32.png"

- name: Send two embedded messages
  community.general.discord:
    webhook_id: "00000"
    webhook_token: "XXXYYY"
    embeds:
        - title: "First message"
          description: "This is my first embedded message"
          footer:
            text: "Author: Ansible"
          image:
            url: "https://docs.ansible.com/favicon/favicon-32x32.png"
        - title: "Second message"
          description: "This is my first second message"
          footer:
            text: "Author: Ansible"
            icon_url: "https://docs.ansible.com/favicon/favicon-32x32.png"
          fields:
            - name: "Field 1"
              value: "Value of my first field"
            - name: "Field 2"
              value: "Value of my second field"
          timestamp: "{{ ansible_date_time.iso8601 }}"
Search
    ↑ ↓ move↵ openesc close