Project

PSDiscord

Simple PowerShell module allowing to send messages to Discord Channel over webhooks

Stars51
Forks7
Open issues2
PowerShell Gallery downloads174734
Releasev0.2.4
Language: PowerShell Updated: 2026-02-14T21:19:09.0000000+00:00

Curated Examples

Send a fact section

Use PSDiscord to send a richer webhook message with facts.

This pattern is useful when a notification should include structured context instead of a single text line.

It is adapted from the source example at Examples/Example - 3.ps1.

When to use this pattern

  • You want a compact environment summary in the message.
  • The output should be easier to scan in Discord.
  • The message should be built from reusable section and fact helpers.

Example

Import-Module PSDiscord

$webhookUrl = Get-Content -LiteralPath "$PSScriptRoot\discord-webhook.txt" -Raw

$facts = @(
    New-DiscordFact -Name '**PS Version**' -Value "$($PSVersionTable.PSVersion)" -Inline $true
    New-DiscordFact -Name '**PS Edition**' -Value "$($PSVersionTable.PSEdition)" -Inline $true
    New-DiscordFact -Name '**Computer Name**' -Value "$($env:COMPUTERNAME)" -Inline $true
)

$section = New-DiscordSection -Title 'Automation status' -Description 'Environment summary' -Facts $facts -Color BlueViolet

Send-DiscordMessage -WebHookUrl $webhookUrl -Sections $section -AvatarName 'Automation'

What this demonstrates

  • building embed-style sections
  • adding inline facts
  • sending a richer webhook payload

Source