Skip to content

Webhook Commands

Webhook commands let you set up real-time notifications when emails are received, stored, or deleted. Webhooks can be configured globally (for all inboxes) or scoped to specific inboxes.

All webhook commands support these global flags:

FlagDescription
--configConfig file (default is $HOME/.config/vsb/config.yaml)
-o, --outputOutput format: pretty, json

Create a new global webhook that receives notifications for all inboxes.

Terminal window
vsb webhook create <url> [flags]
ArgumentDescription
urlThe webhook endpoint URL
FlagDescriptionRequired
--eventEvent type to subscribe to (repeatable)Yes
--templateBuilt-in template: slack, discord, teams, genericNo
--custom-templatePath to custom Go template fileNo
--content-typeContent-Type for custom template (default: application/json)No
--descriptionOptional descriptionNo
--filter-fromFilter by sender email/patternNo
--filter-toFilter by recipient email/patternNo
--filter-subjectExact subject matchNo
--filter-subject-containsSubject contains textNo
--filter-subject-regexSubject regex patternNo
--filter-domainFilter by sender domainNo
--filter-modeFilter logic: all (AND) or any (OR)No
--require-authRequire email passes SPF/DKIM/DMARCNo
EventDescription
email.receivedTriggered when email is received
email.storedTriggered when email is stored
email.deletedTriggered when email is deleted
Terminal window
# Create basic webhook
vsb webhook create https://example.com/webhook --event email.received
# Create webhook for multiple events
vsb webhook create https://example.com/webhook \
--event email.received \
--event email.deleted
# Create Slack webhook with filters
vsb webhook create https://hooks.slack.com/services/xxx \
--event email.received \
--template slack \
--filter-subject-contains "alert" \
--filter-domain example.com \
--filter-mode all \
--description "Alert notifications"
# Create webhook with authentication requirement
vsb webhook create https://example.com/webhook \
--event email.received \
--require-auth
# Create webhook with custom template
vsb webhook create https://example.com/webhook \
--event email.received \
--custom-template ./my-template.tmpl \
--content-type "application/json"
Webhook Created!
ID: wh_abc123
URL: https://example.com/webhook
Events: email.received
Secret: whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Save this secret - you won't be able to see it again.
Use it to verify webhook signatures.

List all global webhooks.

Terminal window
vsb webhook list [flags]
vsb webhook ls [flags]
Terminal window
# List all webhooks
vsb webhook list
vsb webhook ls
# Output as JSON
vsb webhook list -o json
ID URL EVENTS ENABLED DELIVERIES
wh_abc123 https://example.com/webhook email.received Yes 152 (99%)
wh_def456 https://hooks.slack.com/xxx email.received No 50 (90%)
Total: 2 webhook(s)

Get detailed information about a specific webhook.

Terminal window
vsb webhook get <webhook-id>
ArgumentDescription
webhook-idWebhook ID
Terminal window
vsb webhook get wh_abc123
# Output as JSON
vsb webhook get wh_abc123 -o json
Webhook: wh_abc123
CONFIGURATION
URL: https://example.com/webhook
Events: email.received, email.deleted
Scope: global
Enabled: Yes
Template: slack
Description: Alert notifications
FILTERS
Mode: all (AND)
- subject contains "alert"
- domain = example.com
- require-auth: yes
DELIVERY STATS
Total: 152
Successful: 150
Failed: 2
Success Rate: 98.7%
Last Delivery: 2024-01-15 14:30:00
Last Success: 2024-01-15 14:30:00

Update an existing webhook.

Terminal window
vsb webhook update <webhook-id> [flags]
ArgumentDescription
webhook-idWebhook ID
FlagDescription
--urlChange webhook endpoint URL
--eventReplace events (repeatable)
--templateChange to built-in template
--custom-templateChange to custom template
--content-typeContent-Type for custom template
--descriptionUpdate description
--enableEnable webhook
--disableDisable webhook
--clear-filtersRemove all filters
--filter-fromFilter by sender email/pattern
--filter-toFilter by recipient email/pattern
--filter-subjectExact subject match
--filter-subject-containsSubject contains text
--filter-subject-regexSubject regex pattern
--filter-domainFilter by sender domain
--filter-modeFilter logic: all (AND) or any (OR)
--require-authRequire email passes SPF/DKIM/DMARC
Terminal window
# Disable webhook
vsb webhook update wh_abc123 --disable
# Enable webhook
vsb webhook update wh_abc123 --enable
# Change URL
vsb webhook update wh_abc123 --url https://new-endpoint.com/webhook
# Update events
vsb webhook update wh_abc123 --event email.received --event email.stored
# Add filters
vsb webhook update wh_abc123 \
--filter-domain example.com \
--filter-subject-contains "important"
# Clear all filters
vsb webhook update wh_abc123 --clear-filters
# Switch to Discord template
vsb webhook update wh_abc123 --template discord

Delete a webhook.

Terminal window
vsb webhook delete <webhook-id> [flags]
vsb webhook rm <webhook-id> [flags]
ArgumentDescription
webhook-idWebhook ID
FlagDescription
-f, --forceSkip confirmation prompt
Terminal window
# Delete with confirmation
vsb webhook delete wh_abc123
# Delete without confirmation
vsb webhook delete wh_abc123 -f
vsb webhook rm wh_abc123 --force

Rotate the signing secret for a webhook.

Terminal window
vsb webhook rotate <webhook-id> [flags]
ArgumentDescription
webhook-idWebhook ID
FlagDescription
-f, --forceSkip confirmation prompt
Terminal window
# Rotate secret with confirmation
vsb webhook rotate wh_abc123
# Rotate without confirmation
vsb webhook rotate wh_abc123 -f
Secret Rotated!
ID: wh_abc123
New Secret: whsec_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Grace Period Expires: 2024-01-16 14:30:00 (24h)
The previous secret will remain valid for 24 hours.
Update your endpoint to use the new secret before then.

Send a test request to verify a webhook endpoint is reachable.

Terminal window
vsb webhook test <webhook-id>
ArgumentDescription
webhook-idWebhook ID
Terminal window
vsb webhook test wh_abc123
# Output as JSON
vsb webhook test wh_abc123 -o json

Success:

Test Successful!
Status: 200 OK
Response Time: 145ms
Request ID: req_xyz789

Failure:

Test Failed!
Status: Connection refused
Response Time: 5023ms
Request ID: req_xyz789
Error: dial tcp: connection refused

List available built-in webhook templates.

Terminal window
vsb webhook templates
Terminal window
vsb webhook templates
# Output as JSON
vsb webhook templates -o json
TEMPLATE DESCRIPTION
slack Slack incoming webhook format
discord Discord webhook format
teams Microsoft Teams webhook format
generic Generic JSON payload

Slack - Formats the webhook payload for Slack incoming webhooks with message blocks.

Discord - Formats the webhook payload for Discord webhooks with embeds.

Teams - Formats the webhook payload for Microsoft Teams connectors with adaptive cards.

Generic - Sends a plain JSON payload with all email metadata.


Show global webhook delivery metrics.

Terminal window
vsb webhook metrics
Terminal window
vsb webhook metrics
# Output as JSON
vsb webhook metrics -o json
WEBHOOK METRICS
OVERVIEW
Total Webhooks: 5
Active Webhooks: 4
DELIVERY STATS
Total Deliveries: 1,523
Successful: 1,498
Failed: 25
Success Rate: 98.4%
BY SCOPE
global: 850 deliveries
inbox-scoped: 673 deliveries
BY EVENT
email.received: 1,200 deliveries
email.stored: 300 deliveries
email.deleted: 23 deliveries

Webhook filters support pattern matching for flexible notification rules.

Pattern ExampleOperatorDescription
^alert.*regexStarts with ^ - regex match
.*important$regexEnds with $ - regex match
*newsletter*containsContains * - contains match
[email protected]containsDefault - contains match
  • --filter-mode all (default): All filter rules must match (AND logic)
  • --filter-mode any: Any filter rule can match (OR logic)
Terminal window
# Match emails from any @company.com address
vsb webhook create https://example.com/webhook \
--event email.received \
--filter-domain company.com
# Match subjects starting with "URGENT" or "ALERT"
vsb webhook create https://example.com/webhook \
--event email.received \
--filter-subject-regex "^(URGENT|ALERT)"
# Match only authenticated emails from a specific sender
vsb webhook create https://example.com/webhook \
--event email.received \
--filter-from [email protected] \
--require-auth

All webhook requests include an HMAC signature for verification. The signature is computed using the webhook secret and included in the X-VSB-Signature header.

const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto.createHmac('sha256', secret).update(payload).digest('hex');
return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
}