Triggers
SDK reference for triggers — Connect resources (forms, webhooks, schedules, agents) to graphs so they execute automatically.
Connect resources (forms, webhooks, schedules, agents) to graphs so they execute automatically.
createTrigger
Create a trigger that connects a resource to a graph, so when the resource fires (form submission, webhook call, schedule tick, or agent tool call), the graph executes. Requires resourceType (form, webhook, schedule, or agent), resourceId (the resource's ID), and graphId (the target graph).
POST
Usage:
const result = await swirls.client.triggers.createTrigger({
projectId: '...',
graphId: '...',
resourceType: '...',
resourceId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | No | |
projectId | string | Yes | |
graphId | string | Yes | |
resourceType | "form" | "webhook" | "schedule" | "agent" | Yes | |
resourceId | string | Yes | |
enabled | boolean | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
graphId | string | |
resourceType | "form" | "webhook" | "schedule" | "agent" | |
resourceId | string | |
enabled | boolean | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
getTrigger
Get a trigger by ID
GET
Usage:
const result = await swirls.client.triggers.getTrigger({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
graphId | string | |
resourceType | "form" | "webhook" | "schedule" | "agent" | |
resourceId | string | |
enabled | boolean | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
updateTrigger
Update a trigger
PUT
Usage:
const result = await swirls.client.triggers.updateTrigger({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | |
resourceId | string | No | |
graphId | string | No | |
enabled | boolean | No |
Output:
| Field | Type | Description |
|---|---|---|
id | string | |
projectId | string | |
graphId | string | |
resourceType | "form" | "webhook" | "schedule" | "agent" | |
resourceId | string | |
enabled | boolean | |
createdAt | unknown | |
orgId | string | null | |
userId | string |
deleteTrigger
Delete a trigger
DELETE
Usage:
const result = await swirls.client.triggers.deleteTrigger({
id: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
listTriggers
List all triggers in a project. Triggers connect resources (forms, webhooks, schedules, agents) to graphs.
GET
Usage:
const result = await swirls.client.triggers.listTriggers({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
graphId | string | No | |
resourceId | string | No | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
listSchemaIncompatibilities
GET
Usage:
const result = await swirls.client.triggers.listSchemaIncompatibilities({
projectId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | |
pagination | object | No |
Output:
| Field | Type | Description |
|---|---|---|
pagination | object | |
results | object[] | |
totalCount | number |
executeTriggers
Execute all enabled triggers for a resource (form, webhook, or schedule). The resourceId is the ID of the form/webhook/schedule. The "input" object should match the resource's schema — use get_form or get_webhook to inspect the schema first. Returns execution IDs for each triggered graph.
POST
Usage:
const result = await swirls.client.triggers.executeTriggers({
resourceId: '...',
})Input:
| Parameter | Type | Required | Description |
|---|---|---|---|
resourceId | string | Yes | |
resourceType | "form" | "webhook" | "schedule" | No | |
input | object | No |
Output:
| Field | Type | Description |
|---|---|---|
executionIds | string[] |