Triggers
Triggers
@toothfairyai/sdk@latest…Trigger Management Module Handles CRUD operations for event-driven agent triggers.
Accessed via client.triggers.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /trigger/create |
update | POST | POST /trigger/update |
delete | DELETE | DELETE /trigger/delete/{id} |
get | GET | GET /trigger/get/{id} |
list | GET | GET /trigger/list |
pause | — | derived |
resume | — | derived |
create
Create a new trigger
async create(
name: string,
agentId: string,
eventSourceType: 'NATIVE' | 'EXTERNAL',
options: TriggerCreateOptions = {}
)
Endpoint: POST /trigger/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier |
workspaceid | string | yes | Your workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually. |
name | string | yes | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
forcedPrompt | string | no | Forced prompt text to use for the job (max 1024 chars) |
agentID | string | yes | ID of the agent associated with this resource |
customPromptID | string | no | ID of a custom prompt to use |
eventSourceType | string | yes | Event 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
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
name | string | Name of the resource |
description | string | Detailed description of purpose and capabilities |
agentID | string | ID of the agent associated with this resource |
customPromptID | string | ID of a custom prompt to use |
forcedPrompt | string | Forced prompt text to use for the job (max 1024 chars) |
eventSourceType | string | Event 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
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier |
workspaceid | string | no | Your workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually. |
name | string | no | Name of the resource |
description | string | no | Detailed description of purpose and capabilities |
forcedPrompt | string | no | Forced prompt text to use for the job (max 1024 chars) |
agentID | string | no | ID of the agent associated with this resource |
customPromptID | string | no | ID of a custom prompt to use |
eventSourceType | string | no | Event 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
| Field | Type | Description |
|---|---|---|
success | boolean | Operation success status |
data | object | Response data |
message | string | Optional 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');