Integrate

Start with a working definition.

Install the SDK, discover your account resources, and replace the identifiers below. Validate and inspect a dry run before publishing. Publishing activates real triggers.

Source examples for all three workflows are available at workflows.ts. They export typed lead, purchase, and digest factories.

import { Integrate } from '@integratedotdev/sdk';
import { lead } from './workflows';

const client = new Integrate({
  apiKey: process.env.INTEGRATE_API_KEY!
});
const spec = lead({
  tally: 'YOUR_TALLY_CONNECTION', form: 'YOUR_FORM_ID',
  airtable: 'YOUR_AIRTABLE_CONNECTION',
  base: 'YOUR_BASE_ID', table: 'YOUR_TABLE_ID',
  slack: 'YOUR_SLACK_CONNECTION', channel: 'YOUR_CHANNEL_ID'
});
await client.workflows.validate({ spec });
const workflow = await client.workflows.create({ spec });
console.log(await client.workflows.dryRun(workflow.id, {
  email: 'maya@example.com', name: 'Maya Chen'
}));
// Publish after reviewing the draft and dry run.
await client.workflows.publish(workflow.id);

Generic signed webhook

Use a webhook trigger for events from your own server. Publication returns a signing secret and endpoint. Keep that signing secret on your server.

import { createHmac } from 'node:crypto';
const body = JSON.stringify({ email: 'maya@example.com' });
const timestamp = String(Math.floor(Date.now() / 1000));
const signature = createHmac('sha256', process.env.WEBHOOK_SECRET!)
  .update(timestamp + '.' + body).digest('hex');
await fetch(process.env.WEBHOOK_URL!, {
  method: 'POST', body,
  headers: {
    'Content-Type': 'application/json',
    'Integrate-Timestamp': timestamp,
    'Integrate-Signature': signature,
    'Idempotency-Key': 'submission_42'
  }
});

Manual provider endpoints

When a restricted provider key cannot create webhook endpoints, configure the provider endpoint yourself with the published URL and signing secret, then activate the pending version. Stripe endpoints must send checkout.session.completed and checkout.session.async_payment_succeeded. Tally endpoints must send FORM_RESPONSE.