MAIN MENU
Devolutions Blog

Announcements, updates, and insights from Devolutions.

Devolutions PowerShell Universal send Discord messages illustration for the blog.

Send Discord Messages Using PowerShell Universal Trigger

The PowerShell Universal Gallery Discord trigger module sends messages on platform events. Install PowerShellUniversal.Triggers.Discord, set DiscordWebhookUrl, and use Send-PSUDiscordNotification as the trigger script.

The PowerShell Universal Gallery provides a Discord trigger module to send messages when certain events occur within PowerShell Universal. This post walks through setting up those triggers.

Install the Discord trigger module

First, install the PowerShellUniversal.Triggers.Discord module in PowerShell Universal. Click Platform > Gallery and search for Discord. Click Install on the module.

PowerShell Universal Gallery listing the Discord trigger module for install.
Discord trigger module in the PowerShell Universal Gallery

Create a Discord webhook

In Discord, you will need to generate a webhook URL to provide to PowerShell Universal. Copy the webhook URL.

Discord channel settings showing a webhook URL ready to copy.
Discord webhook URL for PowerShell Universal

Store the webhook as a variable

Back in PowerShell Universal, navigate to Platform > Variables and create a new variable named DiscordWebhookUrl.

PowerShell Universal variable form for the DiscordWebhookUrl webhook value.
DiscordWebhookUrl variable in PowerShell Universal

Create the trigger

Finally, click Automation > Triggers and create a new trigger. Select the trigger event type and the Send-PSUDiscordNotification function as the trigger script.

PowerShell Universal trigger form using Send-PSUDiscordNotification as the script.
Discord notification trigger in PowerShell Universal

When jobs fail, they will now send a message to your configured webhook channel in your Discord server.

Discord channel message sent after a PowerShell Universal job failed.
Failed job notification in Discord

You can find more information about the Discord trigger module on the PowerShell Gallery.

Ready to build? Download PowerShell Universal.