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
| Name | Type | Description |
|---|---|---|
params | WebhookEndpointCreateParams | toolkitSlug 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
| Name | Type | Description |
|---|---|---|
nanoId | string | The 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
| Name | Type | Description |
|---|---|---|
query? | WebhookEndpointListParams | Optional 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
| Name | Type | Description |
|---|---|---|
nanoId | string | The endpoint nano id |
params | WebhookEndpointReplaceParams | data 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
| Name | Type | Description |
|---|---|---|
nanoId | string | The endpoint nano id |
params | WebhookEndpointUpdateParams | data 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' },
});