Skip to main content

Usage

Access this class through the composio.triggers property:

Methods

create()

Create a new trigger instance for a user If the connected account id is not provided, the first connected account for the user and toolkit will be used For a trigger that supports both webhook and polling, body.type picks one; omit it to let Composio choose. body.pollingInterval sets the minutes between polls and wins over triggerConfig.interval.
Parameters Returns Promise<TriggerInstanceUpsertResponse> — The trigger instance, with the type it uses, why it polls when it fell back from a webhook, and its polling interval

delete()

Delete a trigger instance
Parameters Returns Promise<TriggerInstanceManageDeleteResponse>

disable()

Disable a trigger instance
Parameters Returns Promise<ManageUpdateResponse> — The updated trigger instance

enable()

Enable a trigger instance
Parameters Returns Promise<ManageUpdateResponse> — The updated trigger instance

getType()

Retrieve a trigger type by its slug for the provided version of the app Use the global toolkit versions param when initializing composio to pass a toolkitversion
Parameters Returns Promise<TriggersTypeRetrieveResponse> — The trigger type object

listActive()

Fetch list of all the active triggers
Parameters Returns Promise<TriggerInstanceListActiveResponse> — List of trigger instances Example

listEnum()

Fetches the list of all the available trigger enums This method is used by the CLI where filters are not required.
Parameters Returns Promise<TriggersTypeRetrieveEnumResponse>

listTypes()

List all the trigger types
Parameters Returns Promise<TriggersTypeListResponse> — The list of trigger types

parse()

Parse an incoming webhook HTTP request into a typed, normalized trigger payload. Dump the incoming request in and get back the parsed Composio trigger event. When verifySecret is provided, the request signature is verified before the payload is returned (delegating to verifyWebhook); without it, the body is parsed without verification. The request may be either a Fetch API Request (Next.js App Router, Hono, Remix) or a plain { body, headers } object (Express with express.raw, Next.js Pages Router req). The signature headers (webhook-id, webhook-timestamp, webhook-signature) are read case-insensitively.
Parameters Returns Promise<VerifyWebhookResult> — The parsed (and optionally verified) webhook payload Example

setWebhookSubscription()

Create or update the project webhook subscription used for webhook delivery. If a subscription already exists, the first subscription is updated. Otherwise a new subscription is created. By default this subscribes to V3 trigger message events.
Parameters Returns Promise<WebhookSubscription> Example

subscribe()

Subscribe to all the triggers
Parameters Returns Promise<void> Example

unsubscribe()

Unsubscribe from all the triggers Ends every subscription made with subscribe on this instance, including one that is still connecting, and closes the realtime connection so that a script can exit. A later subscribe() opens a new connection.
Returns Promise<void> Example

update()

Update an existing trigger instance
Parameters Returns Promise<TriggerInstanceManageUpdateResponse> — The updated trigger instance response

verifyWebhook()

Verify an incoming webhook payload and signature. This method validates that the webhook request is authentic by:
  1. Verifying the HMAC-SHA256 signature matches the payload using the correct signing format
  2. Optionally checking that the webhook timestamp is within the tolerance window
The signature is computed as: HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret) and is expected in the format: v1,base64EncodedSignature
Parameters Returns Promise<VerifyWebhookResult> — The verified and parsed webhook payload with version information Example