Alerts
Alerts
@toothfairyai/sdk@latest…Alert Management Module Handles CRUD operations for alerts.
Accessed via client.alerts.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /alert/create |
update | POST | POST /alert/update |
delete | DELETE | DELETE /alert/delete/{id} |
get | GET | GET /alert/get/{id} |
list | GET | GET /alert/list |
pause | — | derived |
resume | — | derived |
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
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier |
workspaceid | string | yes | Workspace ID (UUID). Must match the workspace the API key belongs to. |
name | string | yes | Name of the alert |
description | string | no | What this alert watches for |
triggerType | string | yes | What 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
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
name | string | Name of the alert |
description | string | What this alert watches for |
triggerType | string | What 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
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier |
workspaceid | string | no | Workspace ID (UUID). Must match the workspace the API key belongs to. |
name | string | no | Name of the alert |
description | string | no | What this alert watches for |
triggerType | string | no | What 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
| Field | Type | Description |
|---|---|---|
success | boolean | Operation success status |
data | object | Response data |
message | string | Optional 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');