Skip to main content

Alerts

Alerts

@toothfairyai/sdk@latest…

Alert Management Module Handles CRUD operations for alerts.

Accessed via client.alerts.

Methods

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

create

Create a new alert operator is one of eq, neq, gt, gte, lt, lte, contains, not_contains

async create(
name: string,
triggerType: 'ANALYTICS' | 'SYSTEM' | 'CUSTOM',
conditions: Array<Record<string, any>>,
options: AlertCreateOptions = {}
)

Endpoint: POST /alert/create · API service

Request fields

FieldTypeRequiredDescription
idstringnoUnique identifier
workspaceidstringyesWorkspace ID (UUID). Must match the workspace the API key belongs to.
namestringyesName of the alert
descriptionstringnoWhat this alert watches for
triggerTypestringyesWhat the alert evaluates: ANALYTICS (custom analytics fields on chats), SYSTEM (platform events) or CUSTOM (custom field conditions)

Allowed: ANALYTICS, SYSTEM, CUSTOM | | conditions | string | yes | Conditions as a JSON string (AWSJSON). All conditions must match for the alert to fire. Array of {field, operator, value} entries; operator is one of: eq, neq, gt, gte, lt, lte, contains, not_contains | | severity | string | no | Severity level used for alert notifications

Allowed: info, warning, critical | | isActive | boolean | no | Whether the alert is active. When off, the alert will not evaluate or notify | | cooldownMinutes | integer | no | Minimum time (in minutes) between repeated notifications for the same alert | | lastTriggeredAt | string | no | Timestamp when the alert last fired | | agentID | string | no | ID of the agent associated with this resource | | recipients | array<string> | no | Workspace user IDs to notify | | recipientEmails | array<string> | no | Additional recipient email addresses | | notifyEmail | boolean | no | Email recipients (workspace users and any additional addresses) | | notifyPush | boolean | no | Send a push notification to recipients' mobile devices | | notifyInApp | boolean | no | Show in the notification bell across web, desktop and mobile | | notifyWebhook | boolean | no | Send a notification to the configured webhook | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource |

Response fields

FieldTypeDescription
idstringUnique identifier
namestringName of the alert
descriptionstringWhat this alert watches for
triggerTypestringWhat the alert evaluates: ANALYTICS (custom analytics fields on chats), SYSTEM (platform events) or CUSTOM (custom field conditions)

Allowed: ANALYTICS, SYSTEM, CUSTOM | | conditions | object | All conditions must match for the alert to fire. Array of {field, operator, value} entries; operator is one of: eq, neq, gt, gte, lt, lte, contains, not_contains | | severity | string | Severity level used for alert notifications

Allowed: info, warning, critical | | isActive | boolean | Whether the alert is active. When off, the alert will not evaluate or notify | | cooldownMinutes | integer | Minimum time (in minutes) between repeated notifications for the same alert | | lastTriggeredAt | string | Timestamp when the alert last fired | | agentID | string | ID of the agent associated with this resource | | recipients | array<string> | Workspace user IDs to notify | | recipientEmails | array<string> | Additional recipient email addresses | | notifyEmail | boolean | Email recipients (workspace users and any additional addresses) | | notifyPush | boolean | Send a push notification to recipients' mobile devices | | notifyInApp | boolean | Show in the notification bell across web, desktop and mobile | | notifyWebhook | boolean | Send a notification to the configured webhook | | 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 |

Example

const result = await client.alerts.create('…',, '…');

update

Update an existing alert

async update(alertId: string, options: AlertUpdateOptions = {})

Endpoint: POST /alert/update · API service

Request fields

FieldTypeRequiredDescription
idstringyesUnique identifier
workspaceidstringnoWorkspace ID (UUID). Must match the workspace the API key belongs to.
namestringnoName of the alert
descriptionstringnoWhat this alert watches for
triggerTypestringnoWhat the alert evaluates: ANALYTICS (custom analytics fields on chats), SYSTEM (platform events) or CUSTOM (custom field conditions)

Allowed: ANALYTICS, SYSTEM, CUSTOM | | conditions | string | no | Conditions as a JSON string (AWSJSON). All conditions must match for the alert to fire. Array of {field, operator, value} entries; operator is one of: eq, neq, gt, gte, lt, lte, contains, not_contains | | severity | string | no | Severity level used for alert notifications

Allowed: info, warning, critical | | isActive | boolean | no | Whether the alert is active. When off, the alert will not evaluate or notify | | cooldownMinutes | integer | no | Minimum time (in minutes) between repeated notifications for the same alert | | lastTriggeredAt | string | no | Timestamp when the alert last fired | | agentID | string | no | ID of the agent associated with this resource | | recipients | array<string> | no | Workspace user IDs to notify | | recipientEmails | array<string> | no | Additional recipient email addresses | | notifyEmail | boolean | no | Email recipients (workspace users and any additional addresses) | | notifyPush | boolean | no | Send a push notification to recipients' mobile devices | | notifyInApp | boolean | no | Show in the notification bell across web, desktop and mobile | | notifyWebhook | boolean | no | Send a notification to the configured webhook | | createdBy | string | no | ID of the user who created this resource | | updatedBy | string | no | ID of the user who last updated this resource |

Response

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

Example

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

delete

Delete an alert

async delete(alertId: string): Promise<

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

Response fields

FieldTypeDescription
successbooleanOperation success status
dataobjectResponse data
messagestringOptional success message

Example

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

get

Get an alert by ID

async get(alertId: string)

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

Response

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

Example

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

list

List all alerts in the workspace

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

Endpoint: GET /alert/list · API service

Response

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

Example

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

pause

Pause an alert (stop evaluating and notifying)

async pause(alertId: string)

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

Example

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

resume

Resume a paused alert

async resume(alertId: string)

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

Example

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