Outbound Integrations
Configure AES-256-GCM encrypted Mailgun, Telegram Bot, and Custom Webhook provider connections and run live connectivity checks via POST /v1/integrations/:id/test.
Outbound integrations store external provider credentials inside a workspace so routing rules can dispatch to email, chat, and HTTP destinations without embedding third-party secrets in your application code.
Channel & Provider Matrix
Every integration pairs an IntegrationChannel with a concrete IntegrationProvider validated by validateChannelProviderPair:
channel | provider | Status | Description |
|---|---|---|---|
WEBHOOK | CUSTOM_WEBHOOK | Active (v0.1) | HTTP/HTTPS POST signed with X-KestrelMQ-Timestamp + X-KestrelMQ-Signature: v1=.... |
EMAIL | MAILGUN | Active (v0.1) | Transactional HTML/text email via Mailgun REST API (US or EU region). |
TELEGRAM | TELEGRAM_BOT | Active (v0.1) | Chat notifications via Telegram Bot sendMessage API. |
EMAIL | RESEND | Planned (v0.2) | Reserved in IntegrationProvider enum; currently rejected with 400 Bad Request. |
EMAIL | SMTP | Planned (v0.2) | Reserved in IntegrationProvider enum; currently rejected with 400 Bad Request. |
Credential Schemas & AES-256-GCM Storage
When you call POST /v1/integrations, KestrelMQ validates credentials against a provider-specific Zod schema, encrypts the serialized JSON with CryptoService.encryptDetached (12B IV + 16B GCM auth tag + ciphertext using ENCRYPTION_MASTER_KEY), and returns a redacted IntegrationResponse (credentials are never returned by GET /v1/integrations).
{
"name": "Order Fulfillment Webhook",
"channel": "WEBHOOK",
"provider": "CUSTOM_WEBHOOK",
"credentials": {
"url": "https://hooks.acme.io/kestrelmq",
"headers": {
"X-Environment": "production"
},
"signingSecret": "whsec_optional_per_integration_override"
},
"isActive": true
}url(required): Validhttp://orhttps://URL (can be overridden per event/rule viatargetOverrideorrecipient.webhookUrl).headers(optional): Custom static HTTP headers. Reserved headers (Content-Type,User-Agent,X-KestrelMQ-Timestamp,X-KestrelMQ-Signature) are ignored so signatures cannot be spoofed.signingSecret(optional): Fallback signing secret if workspacewebhookSigningSecretis not used.
REST Endpoints (/v1/integrations)
All /v1/integrations routes require an operator Access JWT and the X-Workspace-Id header:
| Method | Path | Roles | Status Codes | Description |
|---|---|---|---|---|
POST | /v1/integrations | OWNER, ADMIN | 201, 400, 403 | Validate credentials, seal with AES-256-GCM, and save integration. |
GET | /v1/integrations | OWNER, ADMIN, VIEWER | 200 | List workspace integrations (ciphertext omitted). |
POST | /v1/integrations/:id/test | OWNER, ADMIN | 200, 400, 404, 502 | Decrypt credentials in memory and send a live connectivity ping. |
DELETE | /v1/integrations/:id | OWNER, ADMIN | 204, 404 | Delete integration (cascades associated routing rules). |
Live Connectivity Verification (POST /v1/integrations/:id/test)
Before wiring production routing rules, verify credentials and network reachability with a live test ping (target is optional when the integration has a default URL or chat ID, and required for MAILGUN to specify a test recipient email):
curl -s -X POST http://localhost:3000/v1/integrations/${INTEGRATION_ID}/test \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "X-Workspace-Id: ${WORKSPACE_ID}" \
-H "Content-Type: application/json" \
-d '{
"target": "ops@acme.io"
}'{
"ok": true,
"integrationId": "6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b",
"provider": "MAILGUN",
"statusCode": 200,
"durationMs": 142
}If the upstream provider rejects the test ping or times out, KestrelMQ returns 502 Bad Gateway (application/problem+json) with any secrets redacted from the upstream error message.