Triggers and subscriptions API
Discover canonical triggers and manage push or polling subscriptions.
Discover canonical triggers and manage push or polling subscriptions.
TriggersClient
Canonical trigger discovery from the local open-core catalog.
list
Resolves trigger definitions from the packaged catalog without network I/O.
list(options?: GetTriggersOptions): Promise<readonly TriggerDefinition[]>| Parameter | Type | Required | Description |
|---|---|---|---|
options | GetTriggersOptions | No | Toolkit, capability, and delivery-mode filters. |
Returns: Promise<readonly TriggerDefinition[]>
Throws
- EyeballError with
invalid_inputwhen a toolkit filter is empty.
SubscriptionsClient
User-scoped push and polling trigger subscriptions.
create
Creates a user-scoped push or polling trigger subscription.
create(options: CreateSubscriptionOptions): Promise<CreatedTriggerSubscription>| Parameter | Type | Required | Description |
|---|---|---|---|
options | CreateSubscriptionOptions | Yes | Canonical trigger, destination webhooks, user, connection, and optional polling controls. |
Returns: Promise<CreatedTriggerSubscription>
Throws
- EyeballError when validation, authentication, or executor admission fails.
Example
import { Eyeball } from "@eyeball/sdk";
const eyeball = new Eyeball({
apiKey: process.env.EYEBALL_API_KEY!,
baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});
const subscription = await eyeball.subscriptions.create({
trigger: "slack.message_received",
userId: "user_42",
connectionId: "conn_slack",
webhookEndpointIds: ["whe_events"],
});delete
Permanently removes one trigger subscription.
delete(value: string): Promise<void>| Parameter | Type | Required | Description |
|---|---|---|---|
value | string | Yes | Valid trgsub_* subscription identifier. |
Returns: Promise<void>
Throws
- EyeballError when the identifier is invalid, unavailable, or the request fails.
get
Retrieves one trigger subscription.
get(value: string): Promise<TriggerSubscription>| Parameter | Type | Required | Description |
|---|---|---|---|
value | string | Yes | Valid trgsub_* subscription identifier. |
Returns: Promise<TriggerSubscription>
Throws
- EyeballError when the identifier is invalid, unavailable, or the request fails.
list
Lists trigger subscriptions with optional user and cursor filters.
list(options?: ListSubscriptionsOptions): Promise<TriggerSubscriptionPage>| Parameter | Type | Required | Description |
|---|---|---|---|
options | ListSubscriptionsOptions | No | User scope and pagination controls. |
Returns: Promise<TriggerSubscriptionPage>
Throws
- EyeballError when a filter is invalid or the executor request fails.
rotateSecret
Invalidates a push subscription's current ingest URL and returns its replacement once.
rotateSecret(value: string): Promise<RotatedTriggerIngestSecret>| Parameter | Type | Required | Description |
|---|---|---|---|
value | string | Yes | Valid trgsub_* subscription identifier. |
Returns: Promise<RotatedTriggerIngestSecret>
Throws
- EyeballError for polling subscriptions or unavailable identifiers.
Types
GetTriggersOptions
Local catalog filters for canonical trigger discovery.
export interface GetTriggersOptions {
toolkits?: readonly string[];
capability?: CapabilitySlug;
deliveryMode?: TriggerDefinition["annotations"]["deliveryMode"];
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
capability | "email" | "calendar_scheduling" | "messaging_chat" | "voice_telephony" | "sms" | "crm" | "erp_accounting" | "social_media_data" | "social_media_publishing" | "file_storage_docs" | "spreadsheets_databases" | "project_management_dev_tools" | "payments_billing" | "ecommerce" | "customer_support" | "web_search_scraping" | "hr_recruiting" | "marketing_ads" | "sign_forms" | "ai_media_utilities" | No | No | — |
deliveryMode | "polling" | "push" | No | No | — |
toolkits | readonly string[] | No | No | — |
CreateSubscriptionOptions
Fields accepted when creating a push or polling trigger subscription.
export interface CreateSubscriptionOptions {
trigger: string;
/** Uses the client-level userId when omitted. */
userId?: string;
connectionId?: ConnectionId;
webhookEndpointIds: readonly string[];
filters?: Readonly<Record<string, JsonValue>>;
/** Polling triggers only; the catalog default is used when omitted. */
pollIntervalSeconds?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
connectionId | | No | No | — |
filters | Readonly<Record<string, JsonValue>> | No | No | — |
pollIntervalSeconds | number | No | No | Polling triggers only; the catalog default is used when omitted. |
trigger | string | Yes | No | — |
userId | string | No | No | Uses the client-level userId when omitted. |
webhookEndpointIds | readonly string[] | Yes | No | — |
ListSubscriptionsOptions
User and cursor filters for trigger subscription listing.
export interface ListSubscriptionsOptions {
/** Uses the client-level userId when omitted; omit both to list the project. */
userId?: string;
cursor?: string;
limit?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
cursor | string | No | No | — |
limit | number | No | No | — |
userId | string | No | No | Uses the client-level userId when omitted; omit both to list the project. |
CreatedTriggerSubscription
Push subscriptions reveal their unguessable ingest URL only in the create response.
export interface CreatedTriggerSubscription extends TriggerSubscription {
ingestUrl?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
connectionId | | No | No | — |
createdAt | string | Yes | No | — |
filters | Readonly<Record<string, JsonValue>> | No | No | — |
ingestUrl | string | No | No | — |
pollIntervalSeconds | number | No | No | Polling triggers only; omitted for push subscriptions. |
projectId | string | Yes | No | — |
status | TriggerSubscriptionStatus | Yes | No | — |
subscriptionId | | Yes | No | — |
trigger | | Yes | No | — |
updatedAt | string | Yes | No | — |
userId | string | Yes | No | — |
webhookEndpointIds | readonly string[] | Yes | No | — |
QualifiedTriggerName
export type QualifiedTriggerName = `${string}.${string}`;TriggerDefinition
export interface TriggerDefinition {
/** Exactly `<toolkit>.<canonical-trigger>`. */
name: QualifiedTriggerName;
toolkit: ToolkitSlug;
capability: CapabilitySlug;
description: string;
payloadSchema: ObjectSchema202012;
annotations: TriggerAnnotations;
version: SemVer;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
annotations | TriggerAnnotations | Yes | No | — |
capability | "email" | "calendar_scheduling" | "messaging_chat" | "voice_telephony" | "sms" | "crm" | "erp_accounting" | "social_media_data" | "social_media_publishing" | "file_storage_docs" | "spreadsheets_databases" | "project_management_dev_tools" | "payments_billing" | "ecommerce" | "customer_support" | "web_search_scraping" | "hr_recruiting" | "marketing_ads" | "sign_forms" | "ai_media_utilities" | Yes | No | — |
description | string | Yes | No | — |
name | | Yes | No | Exactly <toolkit>.<canonical-trigger>. |
payloadSchema | ObjectSchema202012 | Yes | No | — |
toolkit | string | Yes | No | — |
version | | Yes | No | — |
TriggerEventData
Payload-bearing canonical event data nested inside the signed webhook envelope.
Queryable history uses TriggerEventRecord, which intentionally cannot expose
provider payload bodies, provider event IDs, credentials, or signing material.
export interface TriggerEventData {
subscriptionId: TriggerSubscriptionId;
trigger: QualifiedTriggerName;
userId: string;
connectionId?: ConnectionId;
providerEventId: string;
occurredAt: string;
payload: Readonly<Record<string, JsonValue>>;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
connectionId | | No | No | — |
occurredAt | string | Yes | No | — |
payload | Readonly<Record<string, JsonValue>> | Yes | No | — |
providerEventId | string | Yes | No | — |
subscriptionId | | Yes | No | — |
trigger | | Yes | No | — |
userId | string | Yes | No | — |
TriggerSubscription
Public, credential-free subscription record. Provider cursors and secrets stay internal.
export interface TriggerSubscription {
subscriptionId: TriggerSubscriptionId;
projectId: string;
userId: string;
trigger: QualifiedTriggerName;
connectionId?: ConnectionId;
webhookEndpointIds: readonly string[];
filters?: Readonly<Record<string, JsonValue>>;
/** Polling triggers only; omitted for push subscriptions. */
pollIntervalSeconds?: number;
status: TriggerSubscriptionStatus;
createdAt: string;
updatedAt: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
connectionId | | No | No | — |
createdAt | string | Yes | No | — |
filters | Readonly<Record<string, JsonValue>> | No | No | — |
pollIntervalSeconds | number | No | No | Polling triggers only; omitted for push subscriptions. |
projectId | string | Yes | No | — |
status | TriggerSubscriptionStatus | Yes | No | — |
subscriptionId | | Yes | No | — |
trigger | | Yes | No | — |
updatedAt | string | Yes | No | — |
userId | string | Yes | No | — |
webhookEndpointIds | readonly string[] | Yes | No | — |
TriggerSubscriptionId
export type TriggerSubscriptionId = `trgsub_${string}`;TriggerSubscriptionPage
export interface TriggerSubscriptionPage {
subscriptions: readonly TriggerSubscription[];
nextCursor?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
nextCursor | string | No | No | — |
subscriptions | readonly TriggerSubscription[] | Yes | No | — |
TriggerWebhookEvent
export interface TriggerWebhookEvent {
id: string;
type: TriggerWebhookEventType;
createdAt: string;
projectId: string;
data: TriggerEventData;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
createdAt | string | Yes | No | — |
data | TriggerEventData | Yes | No | — |
id | string | Yes | No | — |
projectId | string | Yes | No | — |
type | | Yes | No | — |