Skip to content

test-notifications

The test-notifications command sends a test message to all configured notification channels to verify the integration is working correctly.

Terminal window
nextdns-blocker test-notifications [OPTIONS]
OptionDescription
--config-dirConfig directory (default: auto-detect)
--helpShow help message

Before using this command, configure notifications in your config.json:

{
"notifications": {
"enabled": true,
"channels": {
"discord": {
"enabled": true,
"webhook_url": "https://discord.com/api/webhooks/..."
},
"macos": {
"enabled": true,
"sound": true
}
}
}
}
  1. Open Discord and go to your server
  2. Click on the channel where you want notifications
  3. Click the gear icon (Edit Channel)
  4. Go to Integrations > Webhooks
  5. Click New Webhook
  6. Copy the webhook URL

Edit your configuration:

Terminal window
nextdns-blocker config edit

Add the notifications section:

{
"notifications": {
"enabled": true,
"channels": {
"discord": {
"enabled": true,
"webhook_url": "https://discord.com/api/webhooks/123456789/abcdef..."
}
}
}
}
Terminal window
nextdns-blocker test-notifications
Terminal window
nextdns-blocker test-notifications

Output:

Sending test notification...
Discord: Sent successfully
macOS: Sent successfully
All notifications sent!
Terminal window
nextdns-blocker test-notifications

Output:

No notification channels configured.
Add a 'notifications' section to your config.json
Terminal window
nextdns-blocker test-notifications

Output:

Sending test notification...
Discord: Sent successfully
macOS: Not available (not on macOS)

When enabled, NextDNS Blocker sends notifications for:

EventDescription
Sync completeSummary of blocked/unblocked domains
Panic mode activatedAlert when emergency mode starts
Panic mode endedAlert when emergency mode expires
Unblock requestWhen a pending unblock is created
Unblock executedWhen a pending unblock completes
Parental Control changesCategory/service activations

Test notifications appear as:

Discord:

:test_tube: NextDNS Blocker Test
Test Connection
Connection successful!

macOS:

NextDNS Blocker Test
Connection successful!
No notification channels configured.

Solution: Add the notifications section to your config.json:

{
"notifications": {
"enabled": true,
"channels": {
"discord": {
"enabled": true,
"webhook_url": "https://discord.com/api/webhooks/..."
}
}
}
}

If Discord notification fails silently:

  1. Verify the webhook URL is correct and complete
  2. Check the webhook hasn’t been deleted in Discord
  3. Ensure the channel still exists
  4. Try creating a new webhook
macOS: Not available (not on macOS)

This is expected when running on Linux or Windows. macOS notifications only work on macOS.

  1. Check the correct Discord channel
  2. Verify webhook permissions in Discord
  3. Check if notifications are muted for that channel
  4. Test the webhook URL directly:
Terminal window
curl -X POST \
-H "Content-Type: application/json" \
-d '{"content": "Test"}' \
"YOUR_WEBHOOK_URL"

Discord webhooks have rate limits. If sending many notifications:

  • Wait a few minutes before testing again
  • NextDNS Blocker batches notifications to reduce API calls
ChannelPlatformDescription
DiscordAllWebhook notifications with rich embeds
macOSmacOS onlyNative system notifications
  • Keep your webhook URL private
  • Webhook URLs allow anyone to post to your channel
  • Regenerate the webhook if compromised
  • Consider using a private Discord server