Discord Notifications
Account Setup
Section titled “Account Setup”Creating a Discord account is easy. The only part that requires a little bit of extra work is once you’ve got a channel set up (by default discord puts you in a #General channel). Click on the Gear icon (Settings) and from here you need to enable webhooks.
The webhook will end up looking something like this:
https://discordapp.com/api/webhooks/4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js
This effectively equates to:
https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
The last part of the URL you’re given make up the 2 tokens you need to send notifications with. With respect to the above example the tokens are as follows:
- WebhookID is
4174216298 - WebhookToken is
JHMHI8qBe7bk2ZwO5U711o3dV_js
Pinging Roles, Tags, and Users
Section titled “Pinging Roles, Tags, and Users”The discord message body can contain content such as the following to trigger the appropriate pings
- user:
<@123> - role:
<@&456> - tag:
@everyone
Syntax
Section titled “Syntax”Valid syntax is as follows:
https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}discord://{WebhookID}/{WebhookToken}/discord://{botname}@{WebhookID}/{WebhookToken}/
Discord can also support a variety of website arguments, the below identifies the defaults and therefore do not need to be specified unless you want to override them:
discord://{WebhookID}/{WebhookToken}/?tts=No&avatar=Yes&footer=No&image=Yes&batch=Yes
Parameter Breakdown
Section titled “Parameter Breakdown”| Variable | Required | Description |
|---|---|---|
| WebhookID | Yes | The first part of 2 tokens provided to you after creating a incoming-webhook |
| WebhookToken | Yes | The second part of 2 tokens provided to you after creating a incoming-webhook |
| botname | No | Identify the name of the bot that should issue the message. If one isn’t specified then the default is to just use your account (associated with the incoming-webhook). |
| tts | No | Enable Text-To-Speech (by default is is set to No) |
| footer | No | Include a message footer (by default is is set to No) |
| image | No | Include an image in-line with the message describing the notification type (by default is is set to Yes) |
| avatar | No | Over-ride the default discord avatar icon and replace it with one identify the notification type (by default is is set to Yes) |
| avatar_url | No | Over-ride the default discord avatar icon URL. By default this is not set and Apprise chooses the URL dynamically based on the type of message (info, success, warning, or error). |
| format | No | The default value of this is text. But if you plan on managing the format yourself, you can optionally set this to markdown. If the mode is set to markdown, apprise will scan for header entries (usually on lines by themselves surrounded by hashtags (#)) and will place these inside embedded objects. This is done to give a nicer presentation. |
| href | No | Identify a URL the title should link to when posting the Discord Notification. This forces the post into markdown format in order to leverage the embeds section of Discord. You can also use url= as an alias of this as well. |
| thread | No | Optionally set the thread_id you wish your message to be applied to. |
| ping | No | Optionally identify a role, user, our parsed name (such as everyone) that should always be pinged when them message is sent. Follow the syntax identified above for the format. |
| batch | No | When set to Yes (the default), multiple attachments are grouped into a single Discord message where the per-message count and total size limits allow. Set to No to send one attachment per message, which was the only supported behaviour prior to this feature being added. |
| template | No | Provide a path to a JSON file you would prefer to use instead of the default Discord payload constructed by Apprise. Use double \{\{token\}\} curly braces to identify tokens you wish to have substituted in the template before submission (e.g. \{\{app_body\}\} or \{\{app_title\}\}). The template must produce a valid Discord webhook JSON object with a non-empty content string or a non-empty embeds array. |
Global Parameters
Section titled “Global Parameters”| Variable | Description |
|---|---|
| overflow | This parameter can be set to either split, truncate, or upstream. This determines how Apprise delivers the message you pass it. By default this is set to upstream 👉 upstream: Do nothing at all; pass the message exactly as you received it to the service.👉 truncate: Ensure that the message will fit within the service’s documented upstream message limit. If more information was passed then the defined limit, the overhead information is truncated.👉 split: similar to truncate except if the message doesn’t fit within the service’s documented upstream message limit, it is split into smaller chunks and they are all delivered sequentially there-after. |
| format | This parameter can be set to either text, html, or markdown. Some services support the ability to post content by several different means. The default of this varies (it can be one of the 3 mentioned at any time depending on which service you choose). You can optionally force this setting to stray from the defaults if you wish. If the service doesn’t support different types of transmission formats, then this field is ignored. |
| verify | External requests made to secure locations (such as through the use of https) will have certificates associated with them. By default, Apprise will verify that these certificates are valid; if they are not then no notification will be sent to the source. In some occasions, a user might not have a certificate authority to verify the key against or they trust the source; in this case you will want to set this flag to no. By default it is set to yes. |
| redirect | By default, Apprise will follow HTTP redirects (3xx responses) issued by the remote server, matching the behaviour of the underlying requests library. If you want to prevent custom headers and credentials from being forwarded to destinations that differ from the original URL, set this to no. By default it is set to yes. |
| cto | This stands for Socket Connect Timeout. This is the number of seconds Requests will wait for your client to establish a connection to a remote machine (corresponding to the connect()) call on the socket. The default value is 4.0 seconds. |
| rto | This stands for Socket Read Timeout. This is the number of seconds the client will wait for the server to send a response. The default value is 4.0 seconds. |
| emojis | Enable Emoji support (such as providing :+1: would translate to 👍). By default this is set to no. Note: Depending on server side settings, the administrator has the power to disable emoji support at a global level; but default this is not the case. |
| tz | Identify the IANA Time Zone Database you wish to operate as. By default this is detected based on the configuration the server hosting Apprise is running on. You can set this to things like America/Toronto, or any other properly formated Timezone describing your area. |
| retry | The number of additional delivery attempts to make after the first failure before giving up. Accepts an integer in the range 0 to 10. The default is 0 (no retries — a single attempt is made). When combined with wait, Apprise pauses the specified number of seconds between each attempt. |
| wait | The number of seconds to pause between retry attempts. Accepts a decimal value in the range 0.0 to 20.0; integer values are promoted to float automatically. The default is 0.5. This value is only meaningful when retry is greater than zero — a service with retry=0 makes exactly one attempt regardless of the wait value. |
| optional | When set to yes, a delivery failure for this service is silently absorbed. The overall notify() call still returns True even if this endpoint was unreachable, provided that every required (non-optional) service in the same batch succeeded. Setting this flag does not skip delivery or bypass retry logic — all configured retry attempts are still made before the failure is absorbed. By default this is set to no, meaning every failure is propagated to the caller. |
Templating
Section titled “Templating”The ?template= argument lets you supply a pre-built Discord webhook JSON file. Apprise reads the file, substitutes any \{\{token\}\} placeholders, validates the result, and sends it — giving you complete control over the payload layout without modifying any Apprise code.
The template must be a valid JSON object containing at least one of:
- a non-empty
contentstring (plain text message), or - a non-empty
embedsarray (each entry must be a JSON object)
Built-in Tokens
Section titled “Built-in Tokens”The following tokens are always available inside your template and cannot be overridden:
| Token | Description |
|---|---|
app_id | The application identifier; defaults to Apprise. |
app_desc | The application description; defaults to Apprise Notification. |
app_color | The colour as a hex string (e.g. #3AA3E3 for info). Useful inside JSON string values. |
app_color_hex | Explicit alias for app_color; same hex string. Use when you want to name the hex variant clearly. |
app_color_int | The colour as a bare decimal integer (e.g. 3842019). Use this in Discord’s "color" embed field. |
app_type | The message type: info, warning, success, or failure. |
app_title | The notification title passed via --title / -t. |
app_body | The notification body passed via --body / -b. |
app_image_url | The image URL associated with the message type, if one exists. |
app_url | The Apprise instance URL (defaults to https://github.com/caronc/apprise). |
Custom Tokens
Section titled “Custom Tokens”Any token you invent beyond the built-in set can be supplied at send time using the :key=value prefix on the Apprise URL:
discord://{WebhookID}/{WebhookToken}/?template=/path/to/template.json&:service=api-gw&:env=prodInside the template, reference it as {{service}} or {{env}}.
Template Starters
Section titled “Template Starters”Pick one of the ready-to-use templates below, save it as a .json file, and point ?template= at it.
Posts a plain-text message using Discord’s content field. The simplest possible template — no embeds, no colour.
{ "content": "{{app_title}}: {{app_body}}"}A minimal embed with a title and description. Colour reflects the Apprise notification type.
{ "embeds": [ { "title": "{{app_title}}", "description": "{{app_body}}", "color": {{app_color_int}} } ]}A styled embed with a coloured left bar, footer credit, and the Apprise status image as a thumbnail.
{ "embeds": [ { "title": "{{app_title}}", "description": "{{app_body}}", "color": {{app_color_int}}, "thumbnail": { "url": "{{app_image_url}}" }, "footer": { "text": "Sent via {{app_id}}" } } ]}An embed with inline fields for deployment details. Populate {{service}}, {{environment}}, and {{version}} using :key=value tokens on your Apprise URL.
{ "embeds": [ { "title": "{{app_title}}", "description": "{{app_body}}", "color": {{app_color_int}}, "fields": [ { "name": "Service", "value": "{{service}}", "inline": true }, { "name": "Environment", "value": "{{environment}}", "inline": true }, { "name": "Version", "value": "{{version}}", "inline": true } ], "footer": { "text": "{{app_type}} | {{app_id}}" } } ]}Example URL using this template:
discord://{WebhookID}/{WebhookToken}/?template=/etc/apprise/deploy.json&:service=api-gateway&:environment=production&:version=v2.3.1Examples
Section titled “Examples”Send a Discord notification:
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_jsapprise -vv -t "Test Message Title" -b "Test Message Body" \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js"If you want to have your own custom avatar URL you’re already hosting from another website, you could set the following:
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_js# Assuming our {AvatarURL} is https://i.imgur.com/FsEpmwg.jpegapprise -vv -t "Test Message Title" -b "Test Message Body" \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js?avatar_url=https://i.imgur.com/FsEpmwg.jpeg"Send a notification that notifies @everyone in the channel:
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_jsapprise -vv -t "Hello All" -b "Test Message that pings @everyone" \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js"Send multiple attachments in a single Discord message (default behaviour):
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_jsapprise -vv -t "Test Title" -b "Test Body" \ --attach /path/to/file1.png \ --attach /path/to/file2.png \ --attach /path/to/file3.png \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js"Send multiple attachments one per message (legacy behaviour):
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_jsapprise -vv -t "Test Title" -b "Test Body" \ --attach /path/to/file1.png \ --attach /path/to/file2.png \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js?batch=no"Send a notification that leverages the built in markdown support of Discord:
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_jscat << _EOF | apprise -vv "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js?format=markdown"# Title
- Bullet 1- Bullet 2- Bullet 3_EOFSend a notification using a custom template (see the CI/CD Fields starter above):
# Assuming our {WebhookID} is 4174216298# Assuming our {WebhookToken} is JHMHI8qBe7bk2ZwO5U711o3dV_js# Assuming the CI/CD template is saved at /etc/apprise/deploy.jsonapprise -vv -t "Deploy Finished" -b "All checks passed." \ "discord://4174216298/JHMHI8qBe7bk2ZwO5U711o3dV_js?template=/etc/apprise/deploy.json&:service=api-gateway&:environment=production&:version=v2.3.1" Questions or Feedback?
Technical Issues
Having trouble with the code? Open an issue on GitHub: