SDK ReferenceTypeScript SDK

WebhookEndpoints

Usage

Access this class through the composio.webhookEndpoints property:

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

Methods

create()

Create a webhook endpoint for a toolkit + OAuth app pair. Returns the existing endpoint when one already exists for that pair.

async create(params: WebhookEndpointCreateParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>

Parameters

NameTypeDescription
paramsWebhookEndpointCreateParamstoolkitSlug and clientId
requestOptions?ComposioRequestOptions

Returns

Promise<WebhookEndpoint> — The endpoint; register webhookUrl with the provider

Example

const endpoint = await composio.webhooks.endpoints.create({
  toolkitSlug: 'slack',
  clientId: 'my-slack-app-client-id',
});

get()

Retrieve a webhook endpoint by its nano id.

async get(nanoId: string, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>

Parameters

NameTypeDescription
nanoIdstringThe endpoint nano id (e.g. we_abc123)
requestOptions?ComposioRequestOptions

Returns

Promise<WebhookEndpoint> — The endpoint, with secret setup values masked

Example

const endpoint = await composio.webhooks.endpoints.get('we_abc123');
console.log(endpoint.webhookUrl);

list()

List webhook endpoints, optionally filtered by toolkit.

async list(query?: WebhookEndpointListParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpointListResponse>

Parameters

NameTypeDescription
query?WebhookEndpointListParamsOptional toolkitSlug filter
requestOptions?ComposioRequestOptions

Returns

Promise<WebhookEndpointListResponse> — The endpoints

Example

const { items } = await composio.webhooks.endpoints.list({ toolkitSlug: 'slack' });

replace()

Replace the setup fields of a webhook endpoint. All required setup fields for the toolkit must be provided — this is the initial configuration.

async replace(nanoId: string, params: WebhookEndpointReplaceParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>

Parameters

NameTypeDescription
nanoIdstringThe endpoint nano id
paramsWebhookEndpointReplaceParamsdata with every required setup field
requestOptions?ComposioRequestOptions

Returns

Promise<WebhookEndpoint> — The configured endpoint

Example

await composio.webhooks.endpoints.replace('we_abc123', {
  data: { signing_secret: process.env.SLACK_SIGNING_SECRET! },
});

update()

Merge setup fields into a webhook endpoint. Omitted fields are preserved.

async update(nanoId: string, params: WebhookEndpointUpdateParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>

Parameters

NameTypeDescription
nanoIdstringThe endpoint nano id
paramsWebhookEndpointUpdateParamsdata with the fields to change
requestOptions?ComposioRequestOptions

Returns

Promise<WebhookEndpoint> — The updated endpoint

Example

await composio.webhooks.endpoints.update('we_abc123', {
  data: { signing_secret: 'rotated-secret' },
});