@composio/core 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CustomTool-9Vlb4XaS.mjs → CustomTool-B4dQn2M5.mjs} +1 -1
- package/dist/{CustomTool-Ds5aLDth.d.mts → CustomTool-CBx9kzea.d.mts} +1 -1
- package/dist/{FileModifierErrors-WrqokuIF.mjs → FileModifierErrors-D-AKc3ds.mjs} +1 -1
- package/dist/{SsrfErrors-BSVMW915.mjs → SsrfErrors-BekZPeWY.mjs} +59 -12
- package/dist/{Telemetry-a7SOQXcg.mjs → Telemetry-BWKZmDxM.mjs} +2 -2
- package/dist/composio-CPf6NHnB.d.mts +20334 -0
- package/dist/{customTool.types-DHxXBU6E.d.mts → customTool.types-BSbIG1OG.d.mts} +291 -68
- package/dist/docs/reference/sdk-reference/typescript/auth-configs.mdx +20 -12
- package/dist/docs/reference/sdk-reference/typescript/composio.mdx +28 -10
- package/dist/docs/reference/sdk-reference/typescript/connected-accounts.mdx +44 -32
- package/dist/docs/reference/sdk-reference/typescript/custom-toolkits.mdx +8 -6
- package/dist/docs/reference/sdk-reference/typescript/experimental.mdx +4 -3
- package/dist/docs/reference/sdk-reference/typescript/index.mdx +4 -2
- package/dist/docs/reference/sdk-reference/typescript/keyring.mdx +6 -3
- package/dist/docs/reference/sdk-reference/typescript/logs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/mcp.mdx +53 -42
- package/dist/docs/reference/sdk-reference/typescript/meta.json +1 -0
- package/dist/docs/reference/sdk-reference/typescript/remote-file.mdx +5 -14
- package/dist/docs/reference/sdk-reference/typescript/session-configs.mdx +5 -3
- package/dist/docs/reference/sdk-reference/typescript/session-files.mdx +7 -5
- package/dist/docs/reference/sdk-reference/typescript/session-webhooks.mdx +64 -0
- package/dist/docs/reference/sdk-reference/typescript/session.mdx +16 -16
- package/dist/docs/reference/sdk-reference/typescript/sessions.mdx +36 -8
- package/dist/docs/reference/sdk-reference/typescript/toolkits.mdx +14 -11
- package/dist/docs/reference/sdk-reference/typescript/tools.mdx +16 -18
- package/dist/docs/reference/sdk-reference/typescript/triggers.mdx +42 -30
- package/dist/docs/reference/sdk-reference/typescript/usage.mdx +6 -4
- package/dist/docs/reference/sdk-reference/typescript/webhook-endpoints.mdx +9 -7
- package/dist/docs/reference/sdk-reference/typescript/webhook-subscriptions.mdx +13 -9
- package/dist/docs/reference/sdk-reference/typescript/webhooks.mdx +3 -1
- package/dist/{errors-xC13uvaA.mjs → errors-CtIKA9BH.mjs} +2 -2
- package/dist/experimental/index.d.mts +2 -2
- package/dist/experimental/index.mjs +1 -1
- package/dist/{fileUtils.node-CAwIbWYH.mjs → fileUtils.node-BJUYMEph.mjs} +7 -7
- package/dist/index.d.mts +6 -11
- package/dist/index.mjs +526 -233
- package/dist/{jsonSchema-Cc4EtHRw.mjs → jsonSchema-BZoXGUCr.mjs} +2 -2
- package/dist/models/Files.node.mjs +3 -3
- package/dist/{sensitiveFileUploadPaths-CSyJ3Ku8.mjs → sensitiveFileUploadPaths-CcbMAYCC.mjs} +21 -15
- package/dist/{ssrfGuard.node-CdIkwqVu.mjs → ssrfGuard.node-B749ae5Q.mjs} +1 -1
- package/dist/{types-DcdZy5Nc.d.mts → types-ns3Q_WrP.d.mts} +2 -2
- package/dist/utils/config-defaults/ConfigDefaults.node.d.mts +1 -1
- package/dist/utils/config-defaults/ConfigDefaults.workerd.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.d.mts +1 -1
- package/dist/utils/modifiers/FileToolModifier.node.mjs +5 -5
- package/dist/utils/modifiers/FileToolModifier.workerd.d.mts +1 -1
- package/dist/utils/ssrfGuard.node.mjs +1 -1
- package/dist/utils/ssrfGuard.workerd.mjs +1 -1
- package/package.json +2 -2
- package/src/composio.ts +26 -7
- package/src/errors/ComposioError.ts +3 -2
- package/src/index.ts +19 -0
- package/src/lib/toolRouterParams.ts +38 -14
- package/src/models/AuthConfigs.ts +10 -3
- package/src/models/ConnectedAccounts.ts +30 -17
- package/src/models/CustomTool.ts +0 -10
- package/src/models/Keyring.ts +2 -1
- package/src/models/MCP.ts +43 -35
- package/src/models/SessionWebhooks.ts +136 -0
- package/src/models/ToolRouter.ts +39 -4
- package/src/models/ToolRouterSession.ts +2 -2
- package/src/models/ToolRouterSessionFileMount.ts +3 -1
- package/src/models/Toolkits.ts +1 -0
- package/src/models/Tools.ts +4 -8
- package/src/models/Triggers.ts +48 -213
- package/src/models/Webhooks.ts +2 -0
- package/src/provider/ComposioProvider.ts +0 -1
- package/src/telemetry/BatchProcessor.ts +1 -1
- package/src/telemetry/Telemetry.ts +1 -1
- package/src/types/connectedAccountAuthStates.types.ts +0 -1
- package/src/types/provider.types.ts +0 -1
- package/src/types/sessionWebhooks.types.ts +292 -0
- package/src/types/toolRouter.types.ts +33 -4
- package/src/types/triggers.types.ts +4 -0
- package/src/utils/crypto.ts +6 -5
- package/src/utils/env.ts +2 -5
- package/src/utils/fileUtils.node.ts +4 -3
- package/src/utils/logger.ts +19 -9
- package/src/utils/pusher.ts +5 -2
- package/src/utils/readResponseBody.ts +30 -17
- package/src/utils/transformers/authConfigs.ts +0 -1
- package/src/utils/userCallback.ts +3 -1
- package/src/utils/webhookVerification.ts +211 -0
- package/dist/composio-Ba89XGHL.d.mts +0 -9736
|
@@ -8,10 +8,18 @@ description: "First-class API for creating and reusing Composio sessions. `comp
|
|
|
8
8
|
Access this class through the `composio.sessions` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const sessions = composio.sessions;
|
|
13
15
|
```
|
|
14
16
|
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
| Name | Type | Description |
|
|
20
|
+
|------|------|-------------|
|
|
21
|
+
| `webhooks` | `SessionWebhooks` | Read the events Composio sends to the project's session webhook URL, for session hooks with a `webhook` handler. |
|
|
22
|
+
|
|
15
23
|
## Methods
|
|
16
24
|
|
|
17
25
|
### create()
|
|
@@ -29,7 +37,7 @@ origins is logged, so native tools keep working.
|
|
|
29
37
|
|
|
30
38
|
**Overload 1**
|
|
31
39
|
|
|
32
|
-
```typescript
|
|
40
|
+
```typescript signature
|
|
33
41
|
async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
34
42
|
```
|
|
35
43
|
|
|
@@ -47,7 +55,7 @@ async create(userId: string, config: ToolRouterCreateSessionConfig & { mcp: true
|
|
|
47
55
|
|
|
48
56
|
**Overload 2**
|
|
49
57
|
|
|
50
|
-
```typescript
|
|
58
|
+
```typescript signature
|
|
51
59
|
async create(userId: string, config?: ToolRouterCreateSessionConfig, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
52
60
|
```
|
|
53
61
|
|
|
@@ -66,10 +74,30 @@ async create(userId: string, config?: ToolRouterCreateSessionConfig, requestOpti
|
|
|
66
74
|
**Example**
|
|
67
75
|
|
|
68
76
|
```typescript
|
|
69
|
-
import { Composio } from '@composio/core';
|
|
77
|
+
import { Composio, experimental_createTool, experimental_createToolkit } from '@composio/core';
|
|
78
|
+
import { z } from 'zod';
|
|
70
79
|
|
|
71
80
|
const composio = new Composio();
|
|
72
81
|
|
|
82
|
+
const myLocalTool = experimental_createTool('GET_WEATHER', {
|
|
83
|
+
name: 'Get Weather',
|
|
84
|
+
description: 'Get the weather for a city',
|
|
85
|
+
inputParams: z.object({ city: z.string() }),
|
|
86
|
+
execute: async ({ city }) => ({ city, forecast: 'sunny' }),
|
|
87
|
+
});
|
|
88
|
+
const myLocalToolkit = experimental_createToolkit('DEV_TOOLS', {
|
|
89
|
+
name: 'Dev Tools',
|
|
90
|
+
description: 'Local developer utilities',
|
|
91
|
+
tools: [
|
|
92
|
+
experimental_createTool('ECHO', {
|
|
93
|
+
name: 'Echo',
|
|
94
|
+
description: 'Return the input text',
|
|
95
|
+
inputParams: z.object({ text: z.string() }),
|
|
96
|
+
execute: async ({ text }) => ({ text }),
|
|
97
|
+
}),
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
|
|
73
101
|
const session = await composio.sessions.create('user_123', {
|
|
74
102
|
toolkits: ['gmail'],
|
|
75
103
|
manageConnections: true,
|
|
@@ -95,7 +123,7 @@ Delete a tool router session by ID.
|
|
|
95
123
|
Deleted sessions immediately stop being retrievable or executable. Deleting
|
|
96
124
|
a missing or already-deleted session surfaces the backend 404.
|
|
97
125
|
|
|
98
|
-
```typescript
|
|
126
|
+
```typescript signature
|
|
99
127
|
async delete(id: string, requestOptions?: ComposioRequestOptions): Promise<ToolRouterSessionDeleteResponse>
|
|
100
128
|
```
|
|
101
129
|
|
|
@@ -125,7 +153,7 @@ origins is logged, so native tools keep working.
|
|
|
125
153
|
|
|
126
154
|
**Overload 1**
|
|
127
155
|
|
|
128
|
-
```typescript
|
|
156
|
+
```typescript signature
|
|
129
157
|
async use(id: string, options: LocalToolsOptions & { mcp: true }, requestOptions?: ComposioRequestOptions): Promise<Session<TToolCollection, TTool, TProvider>>
|
|
130
158
|
```
|
|
131
159
|
|
|
@@ -143,7 +171,7 @@ async use(id: string, options: LocalToolsOptions & { mcp: true }, requestOptions
|
|
|
143
171
|
|
|
144
172
|
**Overload 2**
|
|
145
173
|
|
|
146
|
-
```typescript
|
|
174
|
+
```typescript signature
|
|
147
175
|
async use(id: string, options?: LocalToolsOptions & { mcp?: boolean }, requestOptions?: ComposioRequestOptions): Promise<SessionWithoutMcp<TToolCollection, TTool, TProvider>>
|
|
148
176
|
```
|
|
149
177
|
|
|
@@ -166,7 +194,7 @@ import { Composio } from '@composio/core';
|
|
|
166
194
|
|
|
167
195
|
const composio = new Composio();
|
|
168
196
|
const id = 'session_123';
|
|
169
|
-
const session = await composio.sessions.use(id);
|
|
197
|
+
const session = await composio.sessions.use(id, { mcp: true });
|
|
170
198
|
|
|
171
199
|
console.log(session.mcp.url);
|
|
172
200
|
console.log(session.mcp.headers);
|
|
@@ -8,8 +8,10 @@ description: "Toolkits class Toolkits are a collection of tools that can be use
|
|
|
8
8
|
Access this class through the `composio.toolkits` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const toolkits = composio.toolkits;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -19,7 +21,7 @@ const result = await composio.toolkits.get({});
|
|
|
19
21
|
Authorizes a user to use a toolkit.
|
|
20
22
|
This method will create an auth config if one doesn't exist and initiate a connection request.
|
|
21
23
|
|
|
22
|
-
```typescript
|
|
24
|
+
```typescript signature
|
|
23
25
|
async authorize(userId: string, toolkitSlug: string, authConfigId?: string, requestOptions?: ComposioRequestOptions): Promise<ConnectionRequest>
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -39,6 +41,7 @@ async authorize(userId: string, toolkitSlug: string, authConfigId?: string, requ
|
|
|
39
41
|
**Example**
|
|
40
42
|
|
|
41
43
|
```typescript
|
|
44
|
+
const userId = 'user_123';
|
|
42
45
|
const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
43
46
|
```
|
|
44
47
|
|
|
@@ -49,7 +52,7 @@ const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
|
49
52
|
Retrieves the version changelog of every toolkit (the last 10 versions
|
|
50
53
|
per toolkit).
|
|
51
54
|
|
|
52
|
-
```typescript
|
|
55
|
+
```typescript signature
|
|
53
56
|
async changelog(requestOptions?: ComposioRequestOptions): Promise<ToolkitChangelogResponse>
|
|
54
57
|
```
|
|
55
58
|
|
|
@@ -79,7 +82,7 @@ Retrieves a specific toolkit by its slug identifier.
|
|
|
79
82
|
|
|
80
83
|
**Overload 1**
|
|
81
84
|
|
|
82
|
-
```typescript
|
|
85
|
+
```typescript signature
|
|
83
86
|
async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<ToolkitRetrieveResponse>
|
|
84
87
|
```
|
|
85
88
|
|
|
@@ -96,7 +99,7 @@ async get(slug: string, requestOptions?: ComposioRequestOptions): Promise<Toolki
|
|
|
96
99
|
|
|
97
100
|
**Overload 2**
|
|
98
101
|
|
|
99
|
-
```typescript
|
|
102
|
+
```typescript signature
|
|
100
103
|
async get(query?: ToolkitListParams, requestOptions?: ComposioRequestOptions): Promise<ToolKitListResponse>
|
|
101
104
|
```
|
|
102
105
|
|
|
@@ -126,7 +129,7 @@ console.log(githubToolkit.authConfigDetails); // Authentication configuration de
|
|
|
126
129
|
|
|
127
130
|
Retrieves the fields required for creating an auth config for a toolkit.
|
|
128
131
|
|
|
129
|
-
```typescript
|
|
132
|
+
```typescript signature
|
|
130
133
|
async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
131
134
|
```
|
|
132
135
|
|
|
@@ -148,7 +151,7 @@ async getAuthConfigCreationFields(toolkitSlug: string, authScheme: AuthSchemeTyp
|
|
|
148
151
|
|
|
149
152
|
Retrieves the fields required for initiating a connected account for a toolkit.
|
|
150
153
|
|
|
151
|
-
```typescript
|
|
154
|
+
```typescript signature
|
|
152
155
|
async getConnectedAccountInitiationFields(toolkitSlug: string, authScheme: AuthSchemeType, options?: { requiredOnly?: boolean }): Promise<ToolkitAuthFieldsResponse>
|
|
153
156
|
```
|
|
154
157
|
|
|
@@ -173,7 +176,7 @@ Retrieves several toolkits by slug in a single request.
|
|
|
173
176
|
Returns the same transformed shape as `composio.toolkits.get({ ... })`.
|
|
174
177
|
Unknown slugs are simply absent from the result.
|
|
175
178
|
|
|
176
|
-
```typescript
|
|
179
|
+
```typescript signature
|
|
177
180
|
async getMany(slugs: string[], params?: ToolkitGetManyParams, requestOptions?: ComposioRequestOptions): Promise<ToolKitListResponse>
|
|
178
181
|
```
|
|
179
182
|
|
|
@@ -205,7 +208,7 @@ Retrieves all toolkit categories available in the Composio SDK.
|
|
|
205
208
|
This method fetches the complete list of categories from the Composio API
|
|
206
209
|
and transforms the response to use camelCase property naming.
|
|
207
210
|
|
|
208
|
-
```typescript
|
|
211
|
+
```typescript signature
|
|
209
212
|
async listCategories(requestOptions?: ComposioRequestOptions): Promise<ToolkitRetrieveCategoriesResponse>
|
|
210
213
|
```
|
|
211
214
|
|
|
@@ -239,7 +242,7 @@ values and the default the API assumes.
|
|
|
239
242
|
Pass a dimension and a value as `grantContext` to
|
|
240
243
|
`composio.toolkits.recommendScopes()` to tailor the recommendation.
|
|
241
244
|
|
|
242
|
-
```typescript
|
|
245
|
+
```typescript signature
|
|
243
246
|
async listGrantContexts(toolkitSlug: string, params?: ToolkitListGrantContextsParams, requestOptions?: ComposioRequestOptions): Promise<ToolkitListGrantContextsResponse>
|
|
244
247
|
```
|
|
245
248
|
|
|
@@ -278,7 +281,7 @@ The answer comes in two variants: `leastPrivilege` (narrowest documented
|
|
|
278
281
|
scope per requirement) and `fewest` (smallest set covering everything).
|
|
279
282
|
Pass `toolkitVersion` from a previous answer to pin the computation.
|
|
280
283
|
|
|
281
|
-
```typescript
|
|
284
|
+
```typescript signature
|
|
282
285
|
async recommendScopes(toolkitSlug: string, params: ToolkitRecommendScopesParams, requestOptions?: ComposioRequestOptions): Promise<ToolkitRecommendScopesResponse>
|
|
283
286
|
```
|
|
284
287
|
|
|
@@ -8,8 +8,10 @@ description: "This class is used to manage tools in the Composio SDK. It provide
|
|
|
8
8
|
Access this class through the `composio.tools` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const tools = composio.tools;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -25,7 +27,7 @@ By default, manual tool execution requires a specific toolkit version. If the ve
|
|
|
25
27
|
the execution will throw a `ComposioToolVersionRequiredError` unless `dangerouslySkipVersionCheck` is set to `true`.
|
|
26
28
|
This helps prevent unexpected behavior when new toolkit versions are released.
|
|
27
29
|
|
|
28
|
-
```typescript
|
|
30
|
+
```typescript signature
|
|
29
31
|
async execute(slug: string, body: ToolExecuteParams, options?: ExecuteToolModifiers & ComposioRequestOptions): Promise<ToolExecuteResponse>
|
|
30
32
|
```
|
|
31
33
|
|
|
@@ -64,6 +66,8 @@ const result = await composio.tools.execute('HACKERNEWS_GET_USER', {
|
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
```typescript
|
|
69
|
+
import { Composio } from '@composio/core';
|
|
70
|
+
|
|
67
71
|
// If toolkitVersions are set during Composio initialization, no need to pass version
|
|
68
72
|
const composio = new Composio({ toolkitVersions: { github: '20250909_00' } });
|
|
69
73
|
const result = await composio.tools.execute('GITHUB_GET_REPOS', {
|
|
@@ -103,7 +107,7 @@ const result = await composio.tools.execute('HACKERNEWS_GET_FRONTPAGE', {
|
|
|
103
107
|
|
|
104
108
|
Executes a tool based on a tool router session.
|
|
105
109
|
|
|
106
|
-
```typescript
|
|
110
|
+
```typescript signature
|
|
107
111
|
async executeSessionTool(toolSlug: string, body: ToolExecuteMetaParams, modifiers?: SessionExecuteMetaModifiers, tool?: Tool, options?: ToolRouterSessionExecuteOptions, requestOptions?: ComposioRequestOptions): Promise<ToolExecuteResponse>
|
|
108
112
|
```
|
|
109
113
|
|
|
@@ -131,7 +135,7 @@ This method fetches the tools from the Composio API and wraps them using the pro
|
|
|
131
135
|
|
|
132
136
|
**Overload 1**
|
|
133
137
|
|
|
134
|
-
```typescript
|
|
138
|
+
```typescript signature
|
|
135
139
|
async get(userId: string, filters: ToolListParams, options?: ProviderOptions & ComposioRequestOptions): Promise<ReturnType<T['wrapTools']>>
|
|
136
140
|
```
|
|
137
141
|
|
|
@@ -149,7 +153,7 @@ async get(userId: string, filters: ToolListParams, options?: ProviderOptions & C
|
|
|
149
153
|
|
|
150
154
|
**Overload 2**
|
|
151
155
|
|
|
152
|
-
```typescript
|
|
156
|
+
```typescript signature
|
|
153
157
|
async get(userId: string, slug: string, options?: ProviderOptions & ComposioRequestOptions): Promise<ReturnType<T['wrapTools']>>
|
|
154
158
|
```
|
|
155
159
|
|
|
@@ -189,7 +193,7 @@ Generates arguments for a tool from a natural-language description of the task.
|
|
|
189
193
|
Composio uses an LLM to fill the tool's input parameters from `text`. Review the
|
|
190
194
|
generated arguments before passing them to `tools.execute()`.
|
|
191
195
|
|
|
192
|
-
```typescript
|
|
196
|
+
```typescript signature
|
|
193
197
|
async getInput(slug: string, body: ToolGetInputParams, requestOptions?: ComposioRequestOptions): Promise<ToolGetInputResponse>
|
|
194
198
|
```
|
|
195
199
|
|
|
@@ -229,7 +233,7 @@ Experimental local tools are session-scoped; attach them when creating or reusin
|
|
|
229
233
|
Tool Router session, then use `session.tools()`, `session.localTools()`, or
|
|
230
234
|
`session.execute()`.
|
|
231
235
|
|
|
232
|
-
```typescript
|
|
236
|
+
```typescript signature
|
|
233
237
|
async getRawComposioToolBySlug(slug: string, options?: ToolRetrievalOptions, requestOptions?: ComposioRequestOptions): Promise<Tool>
|
|
234
238
|
```
|
|
235
239
|
|
|
@@ -293,7 +297,7 @@ them when creating or reusing a Tool Router session, then use `session.tools()`,
|
|
|
293
297
|
`session.localTools()`, or `session.execute()`.
|
|
294
298
|
It provides access to the underlying tool data without provider-specific wrapping.
|
|
295
299
|
|
|
296
|
-
```typescript
|
|
300
|
+
```typescript signature
|
|
297
301
|
async getRawComposioTools(query: ToolListParams, options?: SchemaModifierOptions, requestOptions?: ComposioRequestOptions): Promise<ToolList>
|
|
298
302
|
```
|
|
299
303
|
|
|
@@ -323,12 +327,6 @@ const specificTools = await composio.tools.getRawComposioTools({
|
|
|
323
327
|
tools: ['GITHUB_GET_REPOS', 'HACKERNEWS_GET_USER']
|
|
324
328
|
});
|
|
325
329
|
|
|
326
|
-
// Get tools from specific toolkits
|
|
327
|
-
const githubTools = await composio.tools.getRawComposioTools({
|
|
328
|
-
toolkits: ['github'],
|
|
329
|
-
limit: 10
|
|
330
|
-
});
|
|
331
|
-
|
|
332
330
|
// Get tools with schema transformation
|
|
333
331
|
const customizedTools = await composio.tools.getRawComposioTools({
|
|
334
332
|
toolkits: ['github'],
|
|
@@ -363,7 +361,7 @@ Fetches tools exposed by a tool router session.
|
|
|
363
361
|
This includes helper/meta tools plus any tools preloaded into the session.
|
|
364
362
|
It provides access to the underlying tool data without provider-specific wrapping.
|
|
365
363
|
|
|
366
|
-
```typescript
|
|
364
|
+
```typescript signature
|
|
367
365
|
async getRawToolRouterSessionTools(sessionId: string, options?: SchemaModifierOptions, requestOptions?: ComposioRequestOptions): Promise<ToolList>
|
|
368
366
|
```
|
|
369
367
|
|
|
@@ -395,7 +393,7 @@ Fetches the list of all available tools in the Composio SDK.
|
|
|
395
393
|
This method is mostly used by the CLI to get the list of tools.
|
|
396
394
|
No filtering is done on the tools, the list is cached in the backend, no further optimization is required.
|
|
397
395
|
|
|
398
|
-
```typescript
|
|
396
|
+
```typescript signature
|
|
399
397
|
async getToolsEnum(requestOptions?: ComposioRequestOptions): Promise<ToolRetrieveEnumResponse>
|
|
400
398
|
```
|
|
401
399
|
|
|
@@ -414,7 +412,7 @@ async getToolsEnum(requestOptions?: ComposioRequestOptions): Promise<ToolRetriev
|
|
|
414
412
|
```typescript
|
|
415
413
|
// Get all available tools as an enum
|
|
416
414
|
const toolsEnum = await composio.tools.getToolsEnum();
|
|
417
|
-
console.log(toolsEnum
|
|
415
|
+
console.log(toolsEnum); // ['GITHUB_GET_REPOS', ...]
|
|
418
416
|
```
|
|
419
417
|
|
|
420
418
|
---
|
|
@@ -432,7 +430,7 @@ already include a path. Google Calendar's base URL is
|
|
|
432
430
|
`/calendar/v3/users/me/calendarList` (which resolves to `/calendar/v3/calendar/v3/...`
|
|
433
431
|
and returns a 404 from Google). An absolute URL on the same domain is sent as-is.
|
|
434
432
|
|
|
435
|
-
```typescript
|
|
433
|
+
```typescript signature
|
|
436
434
|
async proxyExecute(body: ToolProxyParams, requestOptions?: ComposioRequestOptions): Promise<ToolProxyResponse>
|
|
437
435
|
```
|
|
438
436
|
|
|
@@ -8,8 +8,10 @@ description: "Trigger (Instance) class"
|
|
|
8
8
|
Access this class through the `composio.triggers` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const triggers = composio.triggers;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -22,7 +24,7 @@ If the connected account id is not provided, the first connected account for the
|
|
|
22
24
|
For a trigger that supports both webhook and polling, `body.type` picks one; omit it to let Composio choose.
|
|
23
25
|
`body.pollingInterval` sets the minutes between polls and wins over `triggerConfig.interval`.
|
|
24
26
|
|
|
25
|
-
```typescript
|
|
27
|
+
```typescript signature
|
|
26
28
|
async create(userId: string, slug: string, body?: TriggerInstanceUpsertParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceUpsertResponse>
|
|
27
29
|
```
|
|
28
30
|
|
|
@@ -46,7 +48,7 @@ when it fell back from a webhook, and its polling interval
|
|
|
46
48
|
|
|
47
49
|
Delete a trigger instance
|
|
48
50
|
|
|
49
|
-
```typescript
|
|
51
|
+
```typescript signature
|
|
50
52
|
async delete(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceManageDeleteResponse>
|
|
51
53
|
```
|
|
52
54
|
|
|
@@ -67,7 +69,7 @@ async delete(triggerId: string, requestOptions?: ComposioRequestOptions): Promis
|
|
|
67
69
|
|
|
68
70
|
Disable a trigger instance
|
|
69
71
|
|
|
70
|
-
```typescript
|
|
72
|
+
```typescript signature
|
|
71
73
|
async disable(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<ManageUpdateResponse>
|
|
72
74
|
```
|
|
73
75
|
|
|
@@ -88,7 +90,7 @@ async disable(triggerId: string, requestOptions?: ComposioRequestOptions): Promi
|
|
|
88
90
|
|
|
89
91
|
Enable a trigger instance
|
|
90
92
|
|
|
91
|
-
```typescript
|
|
93
|
+
```typescript signature
|
|
92
94
|
async enable(triggerId: string, requestOptions?: ComposioRequestOptions): Promise<ManageUpdateResponse>
|
|
93
95
|
```
|
|
94
96
|
|
|
@@ -110,7 +112,7 @@ async enable(triggerId: string, requestOptions?: ComposioRequestOptions): Promis
|
|
|
110
112
|
Retrieve a trigger type by its slug for the provided version of the app
|
|
111
113
|
Use the global toolkit versions param when initializing composio to pass a toolkitversion
|
|
112
114
|
|
|
113
|
-
```typescript
|
|
115
|
+
```typescript signature
|
|
114
116
|
async getType(slug: string, requestOptions?: ComposioRequestOptions): Promise<TriggersTypeRetrieveResponse>
|
|
115
117
|
```
|
|
116
118
|
|
|
@@ -131,7 +133,7 @@ async getType(slug: string, requestOptions?: ComposioRequestOptions): Promise<Tr
|
|
|
131
133
|
|
|
132
134
|
Fetch list of all the active triggers
|
|
133
135
|
|
|
134
|
-
```typescript
|
|
136
|
+
```typescript signature
|
|
135
137
|
async listActive(query?: TriggerInstanceListActiveParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceListActiveResponse>
|
|
136
138
|
```
|
|
137
139
|
|
|
@@ -149,7 +151,7 @@ async listActive(query?: TriggerInstanceListActiveParams, requestOptions?: Compo
|
|
|
149
151
|
**Example**
|
|
150
152
|
|
|
151
153
|
```typescript
|
|
152
|
-
const
|
|
154
|
+
const activeTriggers = await composio.triggers.listActive({
|
|
153
155
|
authConfigIds: ['123'],
|
|
154
156
|
connectedAccountIds: ['456'],
|
|
155
157
|
});
|
|
@@ -163,7 +165,7 @@ Fetches the list of all the available trigger enums
|
|
|
163
165
|
|
|
164
166
|
This method is used by the CLI where filters are not required.
|
|
165
167
|
|
|
166
|
-
```typescript
|
|
168
|
+
```typescript signature
|
|
167
169
|
async listEnum(requestOptions?: ComposioRequestOptions): Promise<TriggersTypeRetrieveEnumResponse>
|
|
168
170
|
```
|
|
169
171
|
|
|
@@ -183,7 +185,7 @@ async listEnum(requestOptions?: ComposioRequestOptions): Promise<TriggersTypeRet
|
|
|
183
185
|
|
|
184
186
|
List all the trigger types
|
|
185
187
|
|
|
186
|
-
```typescript
|
|
188
|
+
```typescript signature
|
|
187
189
|
async listTypes(query?: TriggersTypeListParams, requestOptions?: ComposioRequestOptions): Promise<TriggersTypeListResponse>
|
|
188
190
|
```
|
|
189
191
|
|
|
@@ -214,7 +216,10 @@ Remix) or a plain `{ body, headers }` object (Express with `express.raw`,
|
|
|
214
216
|
Next.js Pages Router `req`). The signature headers (`webhook-id`,
|
|
215
217
|
`webhook-timestamp`, `webhook-signature`) are read case-insensitively.
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
Configure a request body limit in your server or framework as well,
|
|
220
|
+
especially if it buffers the body before calling this method.
|
|
221
|
+
|
|
222
|
+
```typescript signature
|
|
218
223
|
async parse(request: WebhookRequestLike, options?: ParseWebhookOptions): Promise<VerifyWebhookResult>
|
|
219
224
|
```
|
|
220
225
|
|
|
@@ -231,7 +236,7 @@ async parse(request: WebhookRequestLike, options?: ParseWebhookOptions): Promise
|
|
|
231
236
|
|
|
232
237
|
**Example**
|
|
233
238
|
|
|
234
|
-
```typescript
|
|
239
|
+
```typescript nocheck="Express route handler; the checker has no express types"
|
|
235
240
|
// Express with express.raw (verify the signature)
|
|
236
241
|
app.post('/webhooks/composio', express.raw({ type: 'application/json' }), async (req, res) => {
|
|
237
242
|
try {
|
|
@@ -268,7 +273,9 @@ export async function POST(request: Request) {
|
|
|
268
273
|
return new Response('Unauthorized', { status: 401 });
|
|
269
274
|
}
|
|
270
275
|
}
|
|
276
|
+
```
|
|
271
277
|
|
|
278
|
+
```typescript
|
|
272
279
|
// Next.js App Router — parse only (no verification)
|
|
273
280
|
export async function POST(request: Request) {
|
|
274
281
|
const result = await composio.triggers.parse(request);
|
|
@@ -286,7 +293,7 @@ Create or update the project webhook subscription used for webhook delivery.
|
|
|
286
293
|
If a subscription already exists, the first subscription is updated. Otherwise a new
|
|
287
294
|
subscription is created. By default this subscribes to V3 trigger message events.
|
|
288
295
|
|
|
289
|
-
```typescript
|
|
296
|
+
```typescript signature
|
|
290
297
|
async setWebhookSubscription(params: SetWebhookSubscriptionParams): Promise<WebhookSubscription>
|
|
291
298
|
```
|
|
292
299
|
|
|
@@ -303,6 +310,8 @@ async setWebhookSubscription(params: SetWebhookSubscriptionParams): Promise<Webh
|
|
|
303
310
|
**Example**
|
|
304
311
|
|
|
305
312
|
```typescript
|
|
313
|
+
const APP_URL = 'https://your-app.com';
|
|
314
|
+
|
|
306
315
|
await composio.triggers.setWebhookSubscription({
|
|
307
316
|
webhookUrl: `${APP_URL}/webhooks/composio`,
|
|
308
317
|
});
|
|
@@ -314,7 +323,7 @@ await composio.triggers.setWebhookSubscription({
|
|
|
314
323
|
|
|
315
324
|
Subscribe to all the triggers
|
|
316
325
|
|
|
317
|
-
```typescript
|
|
326
|
+
```typescript signature
|
|
318
327
|
async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters?: TriggerSubscribeParams, onSubscriptionError?: (data: Record<string, unknown>) => void): Promise<void>
|
|
319
328
|
```
|
|
320
329
|
|
|
@@ -333,9 +342,9 @@ async subscribe(fn: (_data: IncomingTriggerPayload) => void, filters?: TriggerSu
|
|
|
333
342
|
**Example**
|
|
334
343
|
|
|
335
344
|
```typescript
|
|
336
|
-
triggers.subscribe((data) => {
|
|
345
|
+
await composio.triggers.subscribe((data) => {
|
|
337
346
|
console.log(data);
|
|
338
|
-
}
|
|
347
|
+
});
|
|
339
348
|
```
|
|
340
349
|
|
|
341
350
|
---
|
|
@@ -348,7 +357,7 @@ Ends every subscription made with subscribe on this instance, including one that
|
|
|
348
357
|
still connecting, and closes the realtime connection so that a script can exit. A later
|
|
349
358
|
`subscribe()` opens a new connection.
|
|
350
359
|
|
|
351
|
-
```typescript
|
|
360
|
+
```typescript signature
|
|
352
361
|
async unsubscribe(): Promise<void>
|
|
353
362
|
```
|
|
354
363
|
|
|
@@ -359,11 +368,11 @@ async unsubscribe(): Promise<void>
|
|
|
359
368
|
**Example**
|
|
360
369
|
|
|
361
370
|
```typescript
|
|
362
|
-
composio.
|
|
371
|
+
await composio.triggers.subscribe((data) => {
|
|
363
372
|
console.log(data);
|
|
364
373
|
});
|
|
365
374
|
|
|
366
|
-
await triggers.unsubscribe();
|
|
375
|
+
await composio.triggers.unsubscribe();
|
|
367
376
|
```
|
|
368
377
|
|
|
369
378
|
---
|
|
@@ -372,7 +381,7 @@ await triggers.unsubscribe();
|
|
|
372
381
|
|
|
373
382
|
Update an existing trigger instance
|
|
374
383
|
|
|
375
|
-
```typescript
|
|
384
|
+
```typescript signature
|
|
376
385
|
async update(triggerId: string, body: TriggerInstanceManageUpdateParams, requestOptions?: ComposioRequestOptions): Promise<TriggerInstanceManageUpdateResponse>
|
|
377
386
|
```
|
|
378
387
|
|
|
@@ -401,7 +410,10 @@ This method validates that the webhook request is authentic by:
|
|
|
401
410
|
The signature is computed as: `HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret)`
|
|
402
411
|
and is expected in the format: `v1,base64EncodedSignature`
|
|
403
412
|
|
|
404
|
-
|
|
413
|
+
For a Fetch API `Request`, use parse to enforce a limit while reading
|
|
414
|
+
the body. Set a server request limit if you buffer the payload yourself.
|
|
415
|
+
|
|
416
|
+
```typescript signature
|
|
405
417
|
async verifyWebhook(params: VerifyWebhookParams): Promise<VerifyWebhookResult>
|
|
406
418
|
```
|
|
407
419
|
|
|
@@ -418,26 +430,26 @@ async verifyWebhook(params: VerifyWebhookParams): Promise<VerifyWebhookResult>
|
|
|
418
430
|
**Example**
|
|
419
431
|
|
|
420
432
|
```typescript
|
|
421
|
-
// In
|
|
422
|
-
|
|
433
|
+
// In a webhook route that receives a Fetch API Request (Next.js App Router, Hono, Remix)
|
|
434
|
+
export async function POST(request: Request) {
|
|
423
435
|
try {
|
|
424
436
|
const result = await composio.triggers.verifyWebhook({
|
|
425
|
-
payload:
|
|
426
|
-
signature:
|
|
427
|
-
|
|
428
|
-
|
|
437
|
+
payload: await request.text(),
|
|
438
|
+
signature: request.headers.get('webhook-signature') ?? '',
|
|
439
|
+
id: request.headers.get('webhook-id') ?? '',
|
|
440
|
+
timestamp: request.headers.get('webhook-timestamp') ?? '',
|
|
429
441
|
secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
|
|
430
442
|
});
|
|
431
443
|
|
|
432
444
|
// Process the verified payload
|
|
433
445
|
console.log('Webhook version:', result.version);
|
|
434
446
|
console.log('Received trigger:', result.payload.triggerSlug);
|
|
435
|
-
|
|
447
|
+
return new Response('OK', { status: 200 });
|
|
436
448
|
} catch (error) {
|
|
437
449
|
console.error('Webhook verification failed:', error);
|
|
438
|
-
|
|
450
|
+
return new Response('Unauthorized', { status: 401 });
|
|
439
451
|
}
|
|
440
|
-
}
|
|
452
|
+
}
|
|
441
453
|
```
|
|
442
454
|
|
|
443
455
|
---
|
|
@@ -5,11 +5,13 @@ description: "`composio.experimental.usage` — metering for the project the API
|
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
|
-
Access this class through the `composio.usage` property:
|
|
8
|
+
Access this class through the `composio.experimental.usage` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const usage = composio.experimental.usage;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -19,7 +21,7 @@ const result = await composio.usage.list();
|
|
|
19
21
|
Usage for one metering entity type, grouped by a dimension.
|
|
20
22
|
**Experimental — shape may change in future releases.**
|
|
21
23
|
|
|
22
|
-
```typescript
|
|
24
|
+
```typescript signature
|
|
23
25
|
async breakdown(entityType: string, params?: UsageBreakdownParams, requestOptions?: ComposioRequestOptions): Promise<UsageBreakdownResponse>
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -51,7 +53,7 @@ const byUser = await composio.experimental.usage.breakdown('sessions', {
|
|
|
51
53
|
Usage totals per metering entity type for a time range.
|
|
52
54
|
**Experimental — shape may change in future releases.**
|
|
53
55
|
|
|
54
|
-
```typescript
|
|
56
|
+
```typescript signature
|
|
55
57
|
async summary(params?: UsageSummaryParams, requestOptions?: ComposioRequestOptions): Promise<UsageSummaryResponse>
|
|
56
58
|
```
|
|
57
59
|
|
|
@@ -5,11 +5,13 @@ description: "`composio.webhooks.endpoints` — inbound webhook endpoints. Each
|
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
|
8
|
-
Access this class through the `composio.
|
|
8
|
+
Access this class through the `composio.webhooks.endpoints` property:
|
|
9
9
|
|
|
10
10
|
```typescript
|
|
11
|
+
import { Composio } from '@composio/core';
|
|
12
|
+
|
|
11
13
|
const composio = new Composio({ apiKey: 'your-api-key' });
|
|
12
|
-
const
|
|
14
|
+
const endpoints = composio.webhooks.endpoints;
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
## Methods
|
|
@@ -19,7 +21,7 @@ const result = await composio.webhookEndpoints.list();
|
|
|
19
21
|
Create a webhook endpoint for a toolkit + OAuth app pair. Returns the
|
|
20
22
|
existing endpoint when one already exists for that pair.
|
|
21
23
|
|
|
22
|
-
```typescript
|
|
24
|
+
```typescript signature
|
|
23
25
|
async create(params: WebhookEndpointCreateParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -49,7 +51,7 @@ const endpoint = await composio.webhooks.endpoints.create({
|
|
|
49
51
|
|
|
50
52
|
Retrieve a webhook endpoint by its nano id.
|
|
51
53
|
|
|
52
|
-
```typescript
|
|
54
|
+
```typescript signature
|
|
53
55
|
async get(nanoId: string, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>
|
|
54
56
|
```
|
|
55
57
|
|
|
@@ -77,7 +79,7 @@ console.log(endpoint.webhookUrl);
|
|
|
77
79
|
|
|
78
80
|
List webhook endpoints, optionally filtered by toolkit.
|
|
79
81
|
|
|
80
|
-
```typescript
|
|
82
|
+
```typescript signature
|
|
81
83
|
async list(query?: WebhookEndpointListParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpointListResponse>
|
|
82
84
|
```
|
|
83
85
|
|
|
@@ -105,7 +107,7 @@ const { items } = await composio.webhooks.endpoints.list({ toolkitSlug: 'slack'
|
|
|
105
107
|
Replace the setup fields of a webhook endpoint. All required setup fields
|
|
106
108
|
for the toolkit must be provided — this is the initial configuration.
|
|
107
109
|
|
|
108
|
-
```typescript
|
|
110
|
+
```typescript signature
|
|
109
111
|
async replace(nanoId: string, params: WebhookEndpointReplaceParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>
|
|
110
112
|
```
|
|
111
113
|
|
|
@@ -135,7 +137,7 @@ await composio.webhooks.endpoints.replace('we_abc123', {
|
|
|
135
137
|
|
|
136
138
|
Merge setup fields into a webhook endpoint. Omitted fields are preserved.
|
|
137
139
|
|
|
138
|
-
```typescript
|
|
140
|
+
```typescript signature
|
|
139
141
|
async update(nanoId: string, params: WebhookEndpointUpdateParams, requestOptions?: ComposioRequestOptions): Promise<WebhookEndpoint>
|
|
140
142
|
```
|
|
141
143
|
|