Add an integration
Goal
Create a public.integrations row — the config + credentials handle for outbound HTTP calls (integration-outbound) and inbound webhook routing (integration-routes). See Integrations and webhooks for the full model.
Prerequisites
- A
system_adminlogin — the integrations function enforces it (.framework/functions/integrations.ts,isSystemAdminsignal).
Steps
Choose the integration shape.
integration_type: semantic category —webhook,oauth,api,scheduled_sync(column comment,.framework/migrations/004_core_rpc_and_broker.sql).provider: the vendor name —stripe,openai,generic, … (used as the fallback inbound adapter name).slug: unique per(app_id, account_id)—integrations_app_account_slug_key(.framework/migrations/004_core_rpc_and_broker.sql).
Configure
configandcredentials.config.outbound_adapterselects the adapter module for outbound calls — built-ins:adapters/openai-outbound,adapters/generic-webhook-outbound,adapters/resend-outbound(.framework/functions/integration-outbound.ts).action_config.adaptercan override it per call.credentialsis a map{ field: { source, value } }:source: "value"stores a literal secret;source: "env_var"resolvesvalueas aprocess.envname server-side at call time (.framework/functions/_shared/resolve-credentials.ts).
{ "slug": "acme-api", "name": "Acme API", "integration_type": "api", "provider": "acme", "config": { "base_url": "https://api.acme.test", "outbound_adapter": "adapters/generic-webhook-outbound" }, "credentials": { "api_token": { "source": "env_var", "value": "ACME_API_TOKEN" } } }is_configuredis recomputed on every save —trueonly when every credential entry is present and non-empty (.framework/functions/integrations.ts).- Create the integration. Admin UI → Configs → Integrations → New, or
POST /api/integrations—name,integration_type, andproviderrequired (.framework/functions/integrations.ts). - Call it outbound.
POST /api/integration-outbound(or a pipelinehttp_request/webhook stage) with{ integration_slug, action_config }.action_configcarriesendpoint/url,body,credential_field(defaultapi_token),action_slug,max_attempts, and optionaladapter(.framework/functions/integration-outbound.ts). Deliveries land inwebhook_deliverieswith retry bookkeeping — see integration-outbound reference. - For inbound, point senders at
integration-routesand pick an adapter — see Add a webhook.
Verify
GET /api/integrations?action=list—is_configured: trueonce every credential resolves.- A
webhook_deliveriesrow is written per outbound call withresponse_statusand retry fields.
Common mistakes
- An empty or absent credential means "no auth", not an error.
executeskips resolution for an absent entry or an emptysource: "value"literal and the call goes out without a credential — the stockgeneric-httpseed ({"api_token":{"source":"value","value":""}},.framework/migrations/004_core_rpc_and_broker.sql) therefore works unauthenticated out of the box. Whether a credential is required is the adapter's call:generic-webhook-outboundonly attachesAuthorization: Bearerwhen a credential resolved, whileopenai-outbound/resend-outboundthrow inbuildRequest. What still fails hard: anenv_varentry naming an unset variable (credential_env_missing). - Expecting credentials in reads. Integrations are a protected second-surface table — non-system-admin/machine reads are sanitized to minimal fields; secrets are only resolved server-side (
.framework/functions/_shared/permissions.ts). env_varpointing at a missing env —resolveCredentialthrows before the request is sent and emitsintegration.credential_*audit rows.- Slug not unique within
(app_id, account_id)— the DB unique constraint rejects it; account-scoped and global rows share the key.