Overview
The Integrations system supports three types of connections:- Webhooks - HTTP POST requests to external services
- Custom Scripts - Execute shell scripts or binaries with event data
- Plugin Actions - Trigger plugin actions when events occur
Supported Events
Dispatcharr triggers integrations for these system events:Channel Lifecycle Events
Channel Lifecycle Events
channel_start- Channel stream startedchannel_stop- Channel stream stoppedchannel_reconnect- Channel reconnected after interruptionchannel_error- Channel encountered an errorchannel_failover- Channel switched to backup stream
Stream & Recording Events
Stream & Recording Events
stream_switch- Stream source changedrecording_start- DVR recording startedrecording_end- DVR recording finished
Data Refresh Events
Data Refresh Events
epg_refresh- EPG data refreshedm3u_refresh- M3U playlist refreshed
Client Activity Events
Client Activity Events
client_connect- Client connected to streamclient_disconnect- Client disconnected from stream
Security Events
Security Events
login_failed- Failed login attemptepg_blocked- EPG access blocked (network policy)m3u_blocked- M3U access blocked (network policy)
Creating Webhook Integrations
Create new integration
Click New Integration and configure:
- Name: Descriptive name (e.g., “Discord Notifications”)
- Type: Select Webhook
- URL: Target endpoint (e.g.,
https://discord.com/api/webhooks/...) - Method:
POST(default) - Headers: Optional custom headers (e.g.,
Authorization: Bearer token)
Customize payload (optional)
In the Payload Templates tab, define custom payloads using Jinja2 templates:
Event Payloads
Each event delivers a JSON payload with contextual data:Channel Events
Client Events
Recording Events
Refresh Events
Custom Payload Templates
Use Jinja2 templates to transform event data for external services:Discord Webhook
Slack Webhook
Home Assistant
Custom Script Integrations
Execute shell scripts or binaries with event data passed as environment variables.Creating Script Integration
Create new integration
- Name: “Recording Processor”
- Type: Custom Script
- Script Path:
/data/scripts/process_recording.sh - Working Directory:
/data/scripts(optional)
Write your script
Event data is available via environment variables prefixed with
DISPATCHARR_:process_recording.sh
Available Environment Variables
All event payload keys are available as uppercase environment variables:| Event Key | Environment Variable |
|---|---|
event_type | DISPATCHARR_EVENT_TYPE |
channel_id | DISPATCHARR_CHANNEL_ID |
channel_name | DISPATCHARR_CHANNEL_NAME |
timestamp | DISPATCHARR_TIMESTAMP |
file_path | DISPATCHARR_FILE_PATH |
client_ip | DISPATCHARR_CLIENT_IP |
Plugin Event Subscriptions
Plugins can subscribe to events by specifying anevents array in action definitions:
Testing Integrations
Before going live, test integrations with dummy payloads:Delivery Logs
Dispatcharr records all integration executions:Logs are stored in the database. Configure retention policies via the Integrations settings.
Use Cases
Post-Processing Recordings
Trigger scripts to compress, transcode, or upload recordings:Channel Status Monitoring
Send alerts to Discord when channels fail:Home Automation
Update smart home systems when recordings finish:Multi-Service Notifications
Chain webhooks to notify multiple platforms:- Discord for admin alerts
- Slack for team notifications
- SMS via Twilio for critical errors
- Email for recording summaries
Troubleshooting
Webhook returns 401/403
Webhook returns 401/403
Check authentication headers. Some services require
Authorization headers or API keys.Script not executing
Script not executing
Verify:
- Script has executable permissions (
chmod +x) - Script path is absolute
- Script shebang is correct (
#!/bin/bash) - Check Docker logs for error messages
Template rendering error
Template rendering error
Jinja2 templates must be valid syntax. Check:
- Quotes are properly escaped
- Variables exist in payload
- JSON structure is valid
Events not triggering
Events not triggering
Ensure:
- Integration is enabled
- Event subscriptions are checked
- Event is actually occurring (check System Events log)
Reference Implementation
See the integrations source code:- Models:
apps/connect/models.py:1 - Event Handler:
apps/connect/utils.py:17 - Webhook Handler:
apps/connect/handlers/webhook.py - Script Handler:
apps/connect/handlers/script.py