Webhooks
Webhooks allow external services to trigger jobs and workflows in GoFlow.
Overview
Webhooks are HTTP endpoints that receive POST requests from external services (GitHub, Stripe, Slack, etc.) and automatically:
- Enqueue jobs for background processing
- Start workflows
- Send signals to running workflows
Basic Setup
The handler listens for POST requests and routes them to the appropriate action based on the path.
Job Webhooks
Trigger background jobs from webhooks:
When a POST arrives at /webhooks/github, GoFlow:
- Parses the JSON payload
- Creates a job of type
process_github_event - Adds the payload as job data
- Enqueues it for processing
Your worker then handles it:
Workflow Webhooks
Start workflows from external events:
When Stripe sends an order webhook to /webhooks/order, GoFlow automatically starts the order-process workflow with the payload data as input.
Signature Validation
Validate webhook signatures for security:
GoFlow validates the X-Webhook-Signature header using HMAC-SHA256. Invalid signatures are rejected with 401 Unauthorized.
Custom Payload Transform
Transform incoming webhooks before processing:
The Transform function lets you reshape the incoming payload before it becomes job/workflow input.
Sending Webhooks
Agents can send outgoing webhooks:
This sends a POST request with the payload and returns the response.
Managing Webhooks
API Endpoints
The API server exposes webhook management:
Example: GitHub → Workflow
Complete example of GitHub webhooks triggering deployments:
When GitHub sends a push event:
- GoFlow validates the signature
- Transforms the payload to extract repo, branch, commit
- Starts the
deploy-workflowwith that input - Returns success to GitHub
The workflow then handles the actual deployment.
