@devries-cameron20 / composio-1 / commits / e2779b6ec
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: Update TypeScript SDK reference (#2345)

Co-authored-by: haxzie <53584487+haxzie@users.noreply.github.com>

github-actions[bot] committed Jan 23, 2026 at 17:14 UTC e2779b6eceefed48330b84447c799767aee3e635
4 files changed +91 -18
docs/content/reference/sdk-reference/typescript/composio.mdx
+45 -9
@@ -51,17 +51,16 @@ const composio = new Composio({
51
52 | Name | Type | Description |
53 |------|------|-------------|
54 -| `authConfigs` | `AuthConfigs` | |
55 -| `connectedAccounts` | `ConnectedAccounts` | |
54 +| `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
55 +| `connectedAccounts` | `ConnectedAccounts` | Manage authenticated connections |
56 | `create` | `object` | Creates a new tool router session for a user. |
57 -| `experimental` | `object` | Experimental features |
58 -| `files` | `Files` | |
59 -| `mcp` | `MCP` | |
60 -| `provider` | `TProvider` | |
61 -| `toolkits` | `Toolkits` | |
57 +| `files` | `Files` | Upload and download files |
58 +| `mcp` | `MCP` | Model Context Protocol server management |
59 +| `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
60 +| `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
61 | `toolRouter` | `ToolRouter` | Experimental feature, use with caution |
63 -| `tools` | `Tools` | Core models for Composio. |
64 -| `triggers` | `Triggers` | |
62 +| `tools` | `Tools` | List, retrieve, and execute tools |
63 +| `triggers` | `Triggers` | Manage webhook triggers and event subscriptions |
64 | `use` | `(id: string) => Promise<ToolRouterSession>` | Use an existing tool router session |
65
66 ## Methods
@@ -114,6 +113,43 @@ await composioWithCustomHeaders.tools.list();
113
114 ---
115
116 +### flush()
117 +
118 +Flush any pending telemetry and wait for it to complete.
119 +
120 +In Node.js-compatible environments, telemetry is automatically flushed on process exit.
121 +However, in environments like Cloudflare Workers that don't support process exit events,
122 +you should call this method manually to ensure all telemetry is sent.
123 +
124 +```typescript
125 +async flush(): Promise<void>
126 +```
127 +
128 +**Returns**
129 +
130 +`Promise<void>` — A promise that resolves when all pending telemetry has been sent.
131 +
132 +**Example**
133 +
134 +```typescript
135 +// In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
136 +export default {
137 + async fetch(request: Request, env: Env, ctx: ExecutionContext) {
138 + const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
139 +
140 + // Do your work...
141 + const result = await composio.tools.execute(...);
142 +
143 + // Ensure telemetry flushes before worker terminates
144 + ctx.waitUntil(composio.flush());
145 +
146 + return new Response(JSON.stringify(result));
147 + }
148 +};
149 +```
150 +
151 +---
152 +
153 ### getClient()
154
155 Get the Composio SDK client.
docs/content/reference/sdk-reference/typescript/connected-accounts.mdx
+2 -1
@@ -293,7 +293,7 @@ This method attempts to refresh OAuth tokens or other credentials associated wit
293 the connected account. This is useful when a token has expired or is about to expire.
294
295 ```typescript
296 -async refresh(nanoid: string): Promise<ConnectedAccountRefreshResponse>
296 +async refresh(nanoid: string, options?: { redirectUrl?: string; validateCredentials?: boolean }): Promise<ConnectedAccountRefreshResponse>
297 ```
298
299 **Parameters**
@@ -301,6 +301,7 @@ async refresh(nanoid: string): Promise<ConnectedAccountRefreshResponse>
301 | Name | Type | Description |
302 |------|------|-------------|
303 | `nanoid` | `string` | The unique identifier of the connected account to refresh |
304 +| `options?` | `object` | |
305
306 **Returns**
307
docs/content/reference/sdk-reference/typescript/tools.mdx
+32 -2
@@ -153,7 +153,7 @@ const result = await composio.tools.execute('GITHUB_GET_ISSUES', {
153 Executes a composio meta tool based on tool router session
154
155 ```typescript
156 -async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unknown>; sessionId: string }, modifiers?: ExecuteToolModifiers): Promise<...>
156 +async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unknown>; sessionId: string }, modifiers?: SessionExecuteMetaModifiers): Promise<...>
157 ```
158
159 **Parameters**
@@ -162,7 +162,7 @@ async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unkno
162 |------|------|-------------|
163 | `toolSlug` | `string` | The slug of the tool to execute |
164 | `body` | `object` | The execution parameters |
165 -| `modifiers?` | `ExecuteToolModifiers` | The modifiers to apply to the tool |
165 +| `modifiers?` | `SessionExecuteMetaModifiers` | The modifiers to apply to the tool |
166
167 **Returns**
168
@@ -408,6 +408,36 @@ const authSpecificTools = await composio.tools.getRawComposioTools({
408
409 ---
410
411 +### getRawToolRouterMetaTools()
412 +
413 +Fetches the meta tools for a tool router session.
414 +This method fetches the meta tools from the Composio API and transforms them to the expected format.
415 +It provides access to the underlying meta tool data without provider-specific wrapping.
416 +
417 +```typescript
418 +async getRawToolRouterMetaTools(sessionId: string, options?: SchemaModifierOptions): Promise<ToolList>
419 +```
420 +
421 +**Parameters**
422 +
423 +| Name | Type | Description |
424 +|------|------|-------------|
425 +| `sessionId` | `string` | \{string\} The session id to get the meta tools for |
426 +| `options?` | `SchemaModifierOptions` | \{SchemaModifierOptions\} Optional configuration for tool retrieval |
427 +
428 +**Returns**
429 +
430 +`Promise<ToolList>` — The list of meta tools
431 +
432 +**Example**
433 +
434 +```typescript
435 +const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123');
436 +console.log(metaTools);
437 +```
438 +
439 +---
440 +
441 ### getToolsEnum()
442
443 Fetches the list of all available tools in the Composio SDK.
docs/content/reference/sdk-reference/typescript/triggers.mdx
+12 -6
@@ -262,11 +262,14 @@ async update(triggerId: string, body: { status: 'enable' | 'disable' }): Promise
262 Verify an incoming webhook payload and signature.
263
264 This method validates that the webhook request is authentic by:
265 -1. Verifying the HMAC-SHA256 signature matches the payload
265 +1. Verifying the HMAC-SHA256 signature matches the payload using the correct signing format
266 2. Optionally checking that the webhook timestamp is within the tolerance window
267
268 +The signature is computed as: `HMAC-SHA256(${webhookId}.${webhookTimestamp}.${payload}, secret)`
269 +and is expected in the format: `v1,base64EncodedSignature`
270 +
271 ```typescript
269 -verifyWebhook(params: { payload: string; secret: string; signature: string; tolerance?: number }): object
272 +verifyWebhook(params: object): VerifyWebhookResult
273 ```
274
275 **Parameters**
@@ -277,7 +280,7 @@ verifyWebhook(params: { payload: string; secret: string; signature: string; tole
280
281 **Returns**
282
280 -`object` — The verified and parsed webhook payload
283 +`VerifyWebhookResult` — The verified and parsed webhook payload with version information
284
285 **Example**
286
@@ -285,14 +288,17 @@ verifyWebhook(params: { payload: string; secret: string; signature: string; tole
288 // In an Express.js webhook handler
289 app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
290 try {
288 - const payload = composio.triggers.verifyWebhook({
291 + const result = composio.triggers.verifyWebhook({
292 payload: req.body.toString(),
290 - signature: req.headers['x-composio-signature'] as string,
293 + signature: req.headers['webhook-signature'] as string,
294 + webhookId: req.headers['webhook-id'] as string,
295 + webhookTimestamp: req.headers['webhook-timestamp'] as string,
296 secret: process.env.COMPOSIO_WEBHOOK_SECRET!,
297 });
298
299 // Process the verified payload
295 - console.log('Received trigger:', payload.triggerSlug);
300 + console.log('Webhook version:', result.version);
301 + console.log('Received trigger:', result.payload.triggerSlug);
302 res.status(200).send('OK');
303 } catch (error) {
304 console.error('Webhook verification failed:', error);