A reliable connector has six parts: a settings loader, a scheduler that runs poll jobs, a webhook receiver, a set of flow workers, a state store, and a retry queue. Every part reads from and writes to the state store, which is what lets the connector stop and restart without losing its place.
Webhooks and the scheduler both feed the same flow workers; every worker reads and writes the state store, and failures go to the retry queue.
| Part | Responsibility |
|---|---|
| Settings loader | Reads your integration record with the Connector API Key and keeps the on/off value of each flow up to date |
| Scheduler | Runs each enabled poll job on an interval, for example every 5 minutes. Never runs two copies of the same job at once |
| Webhook receiver | An HTTPS endpoint that accepts Pipe17 webhook calls, records them, and replies immediately |
| Flow workers | One per flow (Chapter 7). Each reads a change, maps it, and writes it to the other side |
| State store | Cursors, ID mappings and processed-event keys (Chapter 4) |
| Retry queue | Holds work that failed, with the next attempt time (Chapter 8) |
You can host these as one process (a small Node.js service with a cron library), or split them across serverless functions with a managed queue and database. The design below works the same either way.
One connector, many integrations
A custom integration is a private connector with a single integration, and it exists only in the organization where you created it. If your connector serves more than one Pipe17 organization, create a custom integration in each one. Each organization then has its own connector, its own integration (identified by the pair orgKey + integrationId), and its own two API keys. Your code and hosting are shared; everything else belongs to one organization.
| Shared by all organizations you serve | Separate for each organization |
|---|---|
| Your code and your hosting |
connectorId and the Connector API Key |
| Your flow list, mappings, connection field and setting definitions (you apply the same definition to each organization's connector) |
integrationId + orgKey and the Integration API Key |
| Flow switches and setting values | |
| Credentials for your system | |
| Cursors, ID mappings, processed events, retry queue | |
| Webhook settings |
In practice:
-
Keep a registry of organizations. For each organization, store its Connector API Key and Integration API Key in your secrets manager, for example under
pipe17/<orgKey>/connectorandpipe17/<orgKey>/<integrationId>. The organization's admin finds both on the integration's API Key tab (the Connector API Key can only be regenerated there, not copied). -
Refresh each integration's record.
GET /integrationswith an organization's Connector API Key returns that organization's integration with itsintegrationId,orgKey,statusandsettings. Refresh on a schedule and when theintegrationswebhook fires. - Run every job once per integration. The scheduler loops over active integrations and passes the pair and its key to each job. Never let one organization's job read another's settings, cursors or key.
-
Scope all state by the pair. Every table in Chapter 4 carries
org_keyandintegration_id. -
Route webhooks by orgKey. Each organization's custom integration has its own webhook settings, and every delivery carries
orgKey, which tells you whose integration it belongs to.
// scheduler.js – run each job for every organization you serve
import { refreshSettings, isFlowEnabled } from './settings.js';
import { pollShippingRequests } from './flows/shippingRequests.js';
// Your own list of organizations that have your custom integration, e.g. [{ orgKey: '<orgKey>' }]
import { organizations } from './organizations.js';
export async function runAll() {
for (const org of organizations) {
const connectorKey = await secrets.get(`pipe17/${org.orgKey}/connector`); // your secrets manager
const integrations = await refreshSettings(connectorKey); // GET /integrations with this org's Connector API Key
for (const integ of integrations.filter((i) => i.status === 'connected')) {
const ctx = {
orgKey: integ.orgKey,
integrationId: integ.integrationId,
key: await secrets.get(`pipe17/${integ.orgKey}/${integ.integrationId}`), // this integration's Integration API Key
settings: integ.settings,
};
if (isFlowEnabled(ctx, 'shipments.out')) await pollShippingRequests(ctx);
// ...the other flows, each with the same ctx
}
}
}Every job and handler in the rest of this guide takes this ctx as its first argument. To keep the examples short, they leave out two things your connector must add: key: ctx.key on every API call (p17(method, path, { key: ctx.key, ... })) and ctx.orgKey + ctx.integrationId on every state lookup.
Placeholders. The examples call a few things you write yourself: mySystem.* (your system's API), state.* (your data-access module, Chapter 4), secrets (your secrets manager), organizations (your list of organizations), contextFor() (looks up an integration in your registry), chunk() (splits a list into batches) and reportException() (Chapter 8).
Honor the flow settings
An admin turns flows on and off under Connection Flow on the integration's Settings tab. The flows you selected when you created the integration start on. Your connector reads them from settings.fields, a list of { path, value } entries where path is the flow name (shipments.out, fulfillments.in, inventory.in, products.out, locations.in). A flow that is off or missing must not run.
// settings.js – load the integration(s) of one connector and read their settings
import { p17 } from './p17.js';
export async function refreshSettings(connectorKey = process.env.PIPE17_CONNECTOR_KEY) {
const res = await p17('GET', '/integrations', {
key: connectorKey,
query: { keys: 'integrationId,orgKey,status,settings,connection' },
});
return res.integrations ?? [];
}
// ctx = { orgKey, integrationId, key, settings } for one integration (see above)
export function isFlowEnabled(ctx, path) {
return ctx.settings?.fields?.find((f) => f.path === path)?.value === true;
}Call refreshSettings() at startup and on a schedule (every 5 minutes is enough). Subscribe to the integrations webhook topic to pick up changes sooner. Check isFlowEnabled() at the start of every job and before handling every webhook.
Also check the integration's status. If it is disabled or error, pause all flows until it returns to connected.
Add your own settings
Use custom settings for anything that differs from one organization to the next: a SKU filter, a default shipping method, a warehouse code. Each organization's admin then sets their own values on the integration's Settings tab, and your code serves them all. The example below adds a productSKUs list that the products flow (7.2) uses as a filter. A setting has two halves:
| Half | Who sets it | Where it lives |
|---|---|---|
| Definition: the field's name, type, label and help text | You, with the Connector API Key | The connector: settings.fields
|
| Value: this organization's SKU list | The organization's admin, on the Settings tab | The integration: settings.fields as { path, value }
|
Step 1 – Read the current settings definition. The connector's settings.fields already holds your flow switches (products.out, shipments.out…), and you must send them back unchanged.
curl -s "$PIPE17_BASE_URL/connectors/<connectorId>" \ -H "X-Pipe17-Key: $PIPE17_CONNECTOR_KEY"
Step 2 – Add the new field and send the complete list back. Treat settings.fields like entities: the PUT replaces the whole list, so always send every field, existing switches included. The products.out entry below shows the shape the app gives a flow switch; copy yours from Step 1 as is. A switch without "common": true no longer shows under Connection Flow.
curl -s -X PUT "$PIPE17_BASE_URL/connectors/<connectorId>" \
-H "Content-Type: application/json" \
-H "X-Pipe17-Key: $PIPE17_CONNECTOR_KEY" \
-d '{
"settings": {
"fields": [
{
"path": "products.out",
"type": "boolean",
"options": {
"label": "<Integration name> Connector pulls products from Pipe17",
"defaultValue": true,
"common": true,
"component": "switch"
}
},
"… the other existing fields from Step 1, unchanged …",
{
"path": "productSKUs",
"type": "array",
"options": {
"label": "Process only these SKUs",
"helperText": "Optional. Exact SKUs to send to the warehouse. Empty means all active products.",
"component": "text-array",
"defaultValue": []
}
}
]
}
}'Replace the quoted placeholder line with the real field objects from Step 1 before sending.
| Field property | Meaning |
|---|---|
path |
The setting's key. Your connector looks it up by this name |
type |
string, number, boolean, date, array, object or json
|
secret |
true to mask the value in the app |
options.label / options.helperText
|
The field's title and the hint shown under it |
options.component |
How the field is drawn, for example switch for a toggle or text-array for a list of values |
options.defaultValue |
The value a new integration starts with |
options.common |
true shows the field under Connection Flow. The app sets it on flow switches |
options.values |
A fixed list of { label, value } choices, for a dropdown |
validation |
Optional list of rules: required, minimum, maximum, minLength, maxLength or regex, each with a value and a message
|
Step 3 – Apply it and fill in the value. Upgrade the integration so it picks up the new field (see Step 3 and Versions and upgrades in Chapter 2). The field then appears on the integration's Settings tab, and the admin enters a value and selects Save. Once saved, the value is on the integration record:
curl -s -G "$PIPE17_BASE_URL/integrations" \ -H "X-Pipe17-Key: $PIPE17_CONNECTOR_KEY" \ --data-urlencode "keys=integrationId,settings"
{
"integrationId": "<integrationId>",
"settings": {
"fields": [
{ "path": "products.out", "value": true },
{ "path": "productSKUs", "value": ["TSHIRT-BLK-M", "TSHIRT-BLK-L"] }
]
}
}Step 4 – Your connector applies it. Read the value with getSetting(ctx, 'productSKUs') (defined below) and pass it to the products call as sku. Because the value belongs to each integration, the same code can serve many organizations, each with its own list. The same pattern works for any per-organization option, for example an inventorySKUs filter for the inventory flow or a default shipping method.
// settings.js – add next to isFlowEnabled()
export function getSetting(ctx, path) {
return ctx.settings?.fields?.find((f) => f.path === path)?.value;
}Troubleshooting
- The integration runs but no data syncs
On the integration's Settings tab, check that the flows your integration supports are on under Connection Flow, and confirm your code reads the latest settings and the integration's status isconnected. - A flow switch or custom setting doesn't appear on the Settings tab
Changes made withPUT /connectorsreach the integration only after an upgrade. Call the upgrade endpoint from Chapter 2. Also check that the PUT kept every existing field, with"common": trueon flow switches. - A workflow keeps running after an admin turns it off
Your code may be using cached settings. Poll for integration updates with theupdatedSincefilter, and refresh your stored settings before each job. - API calls fail with rate-limit errors
Reduce how often your jobs run, or add retries with backoff (Chapter 8).
Next: Chapter 4: Managing state.
Need Help?
If you need additional assistance:
- Use Ask Pippen, our AI agent, located at the top of the platform page.
- Submit a support request with as much relevant detail as possible. Learn how to submit a request.
We're here to help you succeed with your operations.
Comments
0 comments