Docs / Core Concepts

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.

Updated 2026-11-28~5 min readProvider Vault

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:

channelproviderStatusDescription
WEBHOOKCUSTOM_WEBHOOKActive (v0.1)HTTP/HTTPS POST signed with X-KestrelMQ-Timestamp + X-KestrelMQ-Signature: v1=....
EMAILMAILGUNActive (v0.1)Transactional HTML/text email via Mailgun REST API (US or EU region).
TELEGRAMTELEGRAM_BOTActive (v0.1)Chat notifications via Telegram Bot sendMessage API.
EMAILRESENDPlanned (v0.2)Reserved in IntegrationProvider enum; currently rejected with 400 Bad Request.
EMAILSMTPPlanned (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).

POST /v1/integrations · CUSTOM_WEBHOOK
{
  "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): Valid http:// or https:// URL (can be overridden per event/rule via targetOverride or recipient.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 workspace webhookSigningSecret is not used.

REST Endpoints (/v1/integrations)

All /v1/integrations routes require an operator Access JWT and the X-Workspace-Id header:

MethodPathRolesStatus CodesDescription
POST/v1/integrationsOWNER, ADMIN201, 400, 403Validate credentials, seal with AES-256-GCM, and save integration.
GET/v1/integrationsOWNER, ADMIN, VIEWER200List workspace integrations (ciphertext omitted).
POST/v1/integrations/:id/testOWNER, ADMIN200, 400, 404, 502Decrypt credentials in memory and send a live connectivity ping.
DELETE/v1/integrations/:idOWNER, ADMIN204, 404Delete 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):

test-integration.sh
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"
  }'
200 OK · TestIntegrationResponse
{
  "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.