Curated Examples
Send a basic message
Use PSDiscord to send a short Discord webhook notification.
This pattern is useful when a script needs to announce a start, finish, or failure state.
It is adapted from the source example at Examples/Example - 1.ps1.
When to use this pattern
- You need a lightweight webhook notification.
- The webhook URL is supplied by configuration or a secret store.
- The message can be plain text.
Example
Import-Module PSDiscord
$webhookUrl = Get-Content -LiteralPath "$PSScriptRoot\discord-webhook.txt" -Raw
Send-DiscordMessage `
-WebHookUrl $webhookUrl `
-Text 'Nightly checks started.' `
-AvatarName 'Automation'
What this demonstrates
- sending a plain Discord message
- keeping the webhook URL outside the script
- setting a readable sender name