Skip to main content

Triggers

Triggers

@toothfairyai/sdk@latest…

Trigger Management Module Handles CRUD operations for event-driven agent triggers.

Accessed via client.triggers.

Methods

MethodHTTPEndpoint
createPOSTPOST /trigger/create
updatePOSTPOST /trigger/update
deleteDELETEDELETE /trigger/delete/{id}
getGETGET /trigger/get/{id}
listGETGET /trigger/list
pausederived
resumederived

create

Create a new trigger

async create(
name: string,
agentId: string,
eventSourceType: 'NATIVE' | 'EXTERNAL',
options: TriggerCreateOptions = {}
)

Endpoint: POST /trigger/create · API service

Request fields

FieldTypeRequiredDescription
idstringnoUnique identifier
workspaceidstringyesYour workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually.
namestringyesName of the resource
descriptionstringnoDetailed description of purpose and capabilities
forcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agentIDstringyesID of the agent associated with this resource
customPromptIDstringnoID of a custom prompt to use
eventSourceTypestringyesEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | string | no | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | no | Whether the job is currently active | | status | string | no | Current status of the resource

Allowed: ARMED, PAUSED, PENDING, RUNNING, FAILED, COMPLETED, DISABLED | | executionConfig | string | no | JSON-encoded execution configuration | | notificationConfig | string | no | JSON-encoded notification configuration | | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | lastTriggeredAt | string | no | Timestamp when the trigger last fired | | lastEventID | string | no | ID of the last event that triggered this trigger | | triggerCount | integer | no | Number of times this trigger has fired | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource | | createdAt | string | no | Timestamp when this resource was created | | updatedAt | string | no | Timestamp when this resource was last updated |

Response fields

FieldTypeDescription
idstringUnique identifier
namestringName of the resource
descriptionstringDetailed description of purpose and capabilities
agentIDstringID of the agent associated with this resource
customPromptIDstringID of a custom prompt to use
forcedPromptstringForced prompt text to use for the job (max 1024 chars)
eventSourceTypestringEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | object | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | Whether the job is currently active | | status | string | Current status of the resource

Allowed: ARMED, PAUSED, DISABLED, FIRING, COMPLETED, FAILED, PENDING | | lastTriggeredAt | string | Timestamp when the trigger last fired | | lastEventID | string | ID of the last event that triggered this trigger | | triggerCount | integer | Number of times this trigger has fired | | executionConfig | object | JSON-encoded execution configuration | | notificationConfig | object | JSON-encoded notification configuration | | retryConfig | object | JSON-encoded retry policy configuration | | workspaceID | string | Unique workspace identifier (UUID v4) | | createdBy | string | ID of the user who created this resource | | updatedBy | string | ID of the user who last updated this resource | | createdAt | string | Timestamp when this resource was created | | updatedAt | string | Timestamp when this resource was last updated | | metadata | object | Arbitrary metadata key-value pairs (JSON) |

Example

const result = await client.triggers.create('…', 'agent-id',);

update

Update an existing trigger

async update(triggerId: string, options: TriggerUpdateOptions = {})

Endpoint: POST /trigger/update · API service

Request fields

FieldTypeRequiredDescription
idstringyesUnique identifier
workspaceidstringnoYour workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually.
namestringnoName of the resource
descriptionstringnoDetailed description of purpose and capabilities
forcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agentIDstringnoID of the agent associated with this resource
customPromptIDstringnoID of a custom prompt to use
eventSourceTypestringnoEvent source type: NATIVE (internal events) or EXTERNAL (third-party provider events)

Allowed: NATIVE, EXTERNAL | | eventConfig | string | no | JSON-encoded event configuration. NATIVE requires eventType + optional dataFilter. EXTERNAL requires provider, providerEvent, acquisitionMode (POLLING/WEBHOOK), and pollConfig.intervalSeconds (60/120/300/600/1800) | | isActive | boolean | no | Whether the job is currently active | | status | string | no | Current status of the resource

Allowed: ARMED, PAUSED, PENDING, RUNNING, FAILED, COMPLETED, DISABLED | | executionConfig | string | no | JSON-encoded execution configuration | | notificationConfig | string | no | JSON-encoded notification configuration | | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | lastTriggeredAt | string | no | Timestamp when the trigger last fired | | lastEventID | string | no | ID of the last event that triggered this trigger | | triggerCount | integer | no | Number of times this trigger has fired | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource | | createdAt | string | no | Timestamp when this resource was created | | updatedAt | string | no | Timestamp when this resource was last updated |

Response

Returns the Trigger object — fields documented in the create section above.

Example

const result = await client.triggers.update('agent-id');

delete

Delete a trigger

async delete(triggerId: string): Promise<

Endpoint: DELETE /trigger/delete/{id} · API service

Response fields

FieldTypeDescription
successbooleanOperation success status
dataobjectResponse data
messagestringOptional success message

Example

const result = await client.triggers.delete('agent-id');

get

Get a trigger by ID

async get(triggerId: string)

Endpoint: GET /trigger/get/{id} · API service

Response

Returns the Trigger object — fields documented in the create section above.

Example

const result = await client.triggers.get('agent-id');

list

List all triggers in the workspace

async list(limit?: number, offset?: number)

Endpoint: GET /trigger/list · API service

Response

Returns the Trigger object — fields documented in the create section above.

Example

const result = await client.triggers.list();

pause

Pause (disarm) a trigger

async pause(triggerId: string)

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

const result = await client.triggers.pause('agent-id');

resume

Resume (arm) a paused trigger

async resume(triggerId: string)

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example

const result = await client.triggers.resume('agent-id');