Usage
Access this class through thecomposio.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.
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
Returns
Promise<TriggerInstanceManageDeleteResponse>
disable()
Disable a trigger instance
Returns
Promise<ManageUpdateResponse> — The updated trigger instance
enable()
Enable a trigger instance
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
Returns
Promise<TriggersTypeRetrieveResponse> — The trigger type object
listActive()
Fetch list of all the active triggers
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.
Returns
Promise<TriggersTypeRetrieveEnumResponse>
listTypes()
List all the trigger types
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. WhenverifySecret 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.
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.
Returns
Promise<WebhookSubscription>
Example
subscribe()
Subscribe to all the triggers
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 latersubscribe() opens a new connection.
Promise<void>
Example
update()
Update an existing trigger instance
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:- Verifying the HMAC-SHA256 signature matches the payload using the correct signing format
- Optionally checking that the webhook timestamp is within the tolerance window
HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret) and is expected in the format: v1,base64EncodedSignature
Returns
Promise<VerifyWebhookResult> — The verified and parsed webhook payload with version information
Example