SDK ReferenceTypeScript SDK

Triggers

Usage

Access this class through the composio.triggers property:

const composio = new Composio({ apiKey: 'your-api-key' });
const result = await composio.triggers.list();

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

async create(userId: string, slug: string, body?: TriggerInstanceUpsertParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceUpsertResponse>

Parameters

NameTypeDescription
userIdstringThe user id of the trigger instance
slugstringThe slug of the trigger instance
body?TriggerInstanceUpsertParamsThe parameters to create the trigger instance
requestOptions?ComposioRequestOptions

Returns

Promise<TriggerInstanceUpsertResponse> — The created trigger instance


delete()

Delete a trigger instance

async delete(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceManageDeleteResponse>

Parameters

NameTypeDescription
triggerIdstringThe slug of the trigger instance
requestOptions?ComposioRequestOptions

Returns

Promise<TriggerInstanceManageDeleteResponse>


disable()

Disable a trigger instance

async disable(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<ManageUpdateResponse>

Parameters

NameTypeDescription
triggerIdstringThe id of the trigger instance
requestOptions?ComposioRequestOptions

Returns

Promise<ManageUpdateResponse> — The updated trigger instance


enable()

Enable a trigger instance

async enable(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<ManageUpdateResponse>

Parameters

NameTypeDescription
triggerIdstringThe id of the trigger instance
requestOptions?ComposioRequestOptions

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

async getType(slug: string, requestOptions?: ComposioRequestOptions): Promise<TriggersTypeRetrieveResponse>

Parameters

NameTypeDescription
slugstringThe slug of the trigger type
requestOptions?ComposioRequestOptions

Returns

Promise<TriggersTypeRetrieveResponse> — The trigger type object


listActive()

Fetch list of all the active triggers

async listActive(query?: TriggerInstanceListActiveParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceListActiveResponse>

Parameters

NameTypeDescription
query?TriggerInstanceListActiveParamsThe query parameters to filter the trigger instances
requestOptions?ComposioRequestOptions

Returns

Promise<TriggerInstanceListActiveResponse> — List of trigger instances

Example

const triggers = await triggers.listActive({
  authConfigIds: ['123'],
  connectedAccountIds: ['456'],
});

listEnum()

Fetches the list of all the available trigger enums

This method is used by the CLI where filters are not required.

async listEnum(requestOptions?: ComposioRequestOptions): Promise<TriggersTypeRetrieveEnumResponse>

Parameters

NameType
requestOptions?ComposioRequestOptions

Returns

Promise<TriggersTypeRetrieveEnumResponse>


listTypes()

List all the trigger types

async listTypes(query?: TriggersTypeListParams, requestOptions?: ComposioRequestOptions): Promise<TriggersTypeListResponse>

Parameters

NameTypeDescription
query?TriggersTypeListParamsThe query parameters to filter the trigger types
requestOptions?ComposioRequestOptions

Returns

Promise<TriggersTypeListResponse> — The list of trigger types


subscribe()

Subscribe to all the triggers

async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters: TriggerSubscribeParams): Promise<void>

Parameters

NameTypeDescription
fn(_data: IncomingTriggerPayload) => voidThe function to call when a trigger is received
filtersTriggerSubscribeParamsThe filters to apply to the triggers

Returns

Promise<void>

Example

triggers.subscribe((data) => {
  console.log(data);
}, );

unsubscribe()

Unsubscribe from all the triggers

async unsubscribe(): Promise<void>

Returns

Promise<void>

Example

composio.trigger.subscribe((data) => {
  console.log(data);
});

await triggers.unsubscribe();

update()

Update an existing trigger instance

async update(triggerId: string, body: TriggerInstanceManageUpdateParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceManageUpdateResponse>

Parameters

NameTypeDescription
triggerIdstringThe Id of the trigger instance
bodyTriggerInstanceManageUpdateParamsThe parameters to update the trigger instance
requestOptions?ComposioRequestOptions

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

async verifyWebhook(params: VerifyWebhookParams): Promise<VerifyWebhookResult>

Parameters

NameTypeDescription
paramsVerifyWebhookParamsThe verification parameters

Returns

Promise<VerifyWebhookResult> — The verified and parsed webhook payload with version information

Example

// In an Express.js webhook handler
app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
  try {
    const result = await composio.triggers.verifyWebhook({
      payload: req.body.toString(),
      signature: req.headers['webhook-signature'] as string,
      webhookId: req.headers['webhook-id'] as string,
      webhookTimestamp: req.headers['webhook-timestamp'] as string,
      secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
    });

    // Process the verified payload
    console.log('Webhook version:', result.version);
    console.log('Received trigger:', result.payload.triggerSlug);
    res.status(200).send('OK');
  } catch (error) {
    console.error('Webhook verification failed:', error);
    res.status(401).send('Unauthorized');
  }
});