test-notifications
The test-notifications command sends a test message to all configured notification channels to verify the integration is working correctly.
nextdns-blocker test-notifications [OPTIONS]Options
Section titled “Options”| Option | Description |
|---|---|
--config-dir | Config directory (default: auto-detect) |
--help | Show help message |
Prerequisites
Section titled “Prerequisites”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 } } }}Setting Up Notifications
Section titled “Setting Up Notifications”1. Create a Discord Webhook
Section titled “1. Create a Discord Webhook”- Open Discord and go to your server
- Click on the channel where you want notifications
- Click the gear icon (Edit Channel)
- Go to Integrations > Webhooks
- Click New Webhook
- Copy the webhook URL
2. Configure in config.json
Section titled “2. Configure in config.json”Edit your configuration:
nextdns-blocker config editAdd the notifications section:
{ "notifications": { "enabled": true, "channels": { "discord": { "enabled": true, "webhook_url": "https://discord.com/api/webhooks/123456789/abcdef..." } } }}3. Test the Integration
Section titled “3. Test the Integration”nextdns-blocker test-notificationsExample
Section titled “Example”Successful Test
Section titled “Successful Test”nextdns-blocker test-notificationsOutput:
Sending test notification... Discord: Sent successfully macOS: Sent successfully All notifications sent!Missing Configuration
Section titled “Missing Configuration”nextdns-blocker test-notificationsOutput:
No notification channels configured. Add a 'notifications' section to your config.jsonPartial Success
Section titled “Partial Success”nextdns-blocker test-notificationsOutput:
Sending test notification... Discord: Sent successfully macOS: Not available (not on macOS)What Notifications Are Sent
Section titled “What Notifications Are Sent”When enabled, NextDNS Blocker sends notifications for:
| Event | Description |
|---|---|
| Sync complete | Summary of blocked/unblocked domains |
| Panic mode activated | Alert when emergency mode starts |
| Panic mode ended | Alert when emergency mode expires |
| Unblock request | When a pending unblock is created |
| Unblock executed | When a pending unblock completes |
| Parental Control changes | Category/service activations |
Notification Format
Section titled “Notification Format”Test notifications appear as:
Discord:
:test_tube: NextDNS Blocker TestTest ConnectionConnection successful!macOS:
NextDNS Blocker TestConnection successful!Troubleshooting
Section titled “Troubleshooting”No channels configured
Section titled “No channels configured”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/..." } } }}Discord webhook failed
Section titled “Discord webhook failed”If Discord notification fails silently:
- Verify the webhook URL is correct and complete
- Check the webhook hasn’t been deleted in Discord
- Ensure the channel still exists
- Try creating a new webhook
macOS notifications not available
Section titled “macOS notifications not available”macOS: Not available (not on macOS)This is expected when running on Linux or Windows. macOS notifications only work on macOS.
Notification not appearing in Discord
Section titled “Notification not appearing in Discord”- Check the correct Discord channel
- Verify webhook permissions in Discord
- Check if notifications are muted for that channel
- Test the webhook URL directly:
curl -X POST \ -H "Content-Type: application/json" \ -d '{"content": "Test"}' \ "YOUR_WEBHOOK_URL"Rate limiting
Section titled “Rate limiting”Discord webhooks have rate limits. If sending many notifications:
- Wait a few minutes before testing again
- NextDNS Blocker batches notifications to reduce API calls
Supported Channels
Section titled “Supported Channels”| Channel | Platform | Description |
|---|---|---|
| Discord | All | Webhook notifications with rich embeds |
| macOS | macOS only | Native system notifications |
Security Notes
Section titled “Security Notes”- 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
Related
Section titled “Related”- Notifications Feature - Complete notification setup guide
- config.json Structure - Configuration file reference