Skip to content

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)

github-actions[bot]e2779b6eceef
diff --git a/docs/content/reference/sdk-reference/typescript/composio.mdx b/docs/content/reference/sdk-reference/typescript/composio.mdx
index d89028c2c..4726c9131 100644
--- a/docs/content/reference/sdk-reference/typescript/composio.mdx
+++ b/docs/content/reference/sdk-reference/typescript/composio.mdx
@@ -51,17 +51,16 @@ const composio = new Composio({
| Name | Type | Description |
|------|------|-------------|
-| `authConfigs` | `AuthConfigs` | |
-| `connectedAccounts` | `ConnectedAccounts` | |
+| `authConfigs` | `AuthConfigs` | Manage authentication configurations for toolkits |
+| `connectedAccounts` | `ConnectedAccounts` | Manage authenticated connections |
| `create` | `object` | Creates a new tool router session for a user. |
-| `experimental` | `object` | Experimental features |
-| `files` | `Files` | |
-| `mcp` | `MCP` | |
-| `provider` | `TProvider` | |
-| `toolkits` | `Toolkits` | |
+| `files` | `Files` | Upload and download files |
+| `mcp` | `MCP` | Model Context Protocol server management |
+| `provider` | `TProvider` | The tool provider instance used for wrapping tools in framework-specific formats |
+| `toolkits` | `Toolkits` | Retrieve toolkit metadata and authorize user connections |
| `toolRouter` | `ToolRouter` | Experimental feature, use with caution |
-| `tools` | `Tools` | Core models for Composio. |
-| `triggers` | `Triggers` | |
+| `tools` | `Tools` | List, retrieve, and execute tools |
+| `triggers` | `Triggers` | Manage webhook triggers and event subscriptions |
| `use` | `(id: string) => Promise<ToolRouterSession>` | Use an existing tool router session |
## Methods
@@ -114,6 +113,43 @@ await composioWithCustomHeaders.tools.list();
---
+### flush()
+
+Flush any pending telemetry and wait for it to complete.
+
+In Node.js-compatible environments, telemetry is automatically flushed on process exit.
+However, in environments like Cloudflare Workers that don't support process exit events,
+you should call this method manually to ensure all telemetry is sent.
+
+```typescript
+async flush(): Promise<void>
+```
+
+**Returns**
+
+`Promise<void>` — A promise that resolves when all pending telemetry has been sent.
+
+**Example**
+
+```typescript
+// In a Cloudflare Worker, use ctx.waitUntil to ensure telemetry is flushed
+export default {
+ async fetch(request: Request, env: Env, ctx: ExecutionContext) {
+ const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY });
+
+ // Do your work...
+ const result = await composio.tools.execute(...);
+
+ // Ensure telemetry flushes before worker terminates
+ ctx.waitUntil(composio.flush());
+
+ return new Response(JSON.stringify(result));
+ }
+};
+```
+
+---
+
### getClient()
Get the Composio SDK client.
diff --git a/docs/content/reference/sdk-reference/typescript/connected-accounts.mdx b/docs/content/reference/sdk-reference/typescript/connected-accounts.mdx
index 5f9b9191d..637e4e238 100644
--- a/docs/content/reference/sdk-reference/typescript/connected-accounts.mdx
+++ b/docs/content/reference/sdk-reference/typescript/connected-accounts.mdx
@@ -293,7 +293,7 @@ This method attempts to refresh OAuth tokens or other credentials associated wit
the connected account. This is useful when a token has expired or is about to expire.
```typescript
-async refresh(nanoid: string): Promise<ConnectedAccountRefreshResponse>
+async refresh(nanoid: string, options?: { redirectUrl?: string; validateCredentials?: boolean }): Promise<ConnectedAccountRefreshResponse>
```
**Parameters**
@@ -301,6 +301,7 @@ async refresh(nanoid: string): Promise<ConnectedAccountRefreshResponse>
| Name | Type | Description |
|------|------|-------------|
| `nanoid` | `string` | The unique identifier of the connected account to refresh |
+| `options?` | `object` | |
**Returns**
diff --git a/docs/content/reference/sdk-reference/typescript/tools.mdx b/docs/content/reference/sdk-reference/typescript/tools.mdx
index 12f4bd6f4..5f50d8459 100644
--- a/docs/content/reference/sdk-reference/typescript/tools.mdx
+++ b/docs/content/reference/sdk-reference/typescript/tools.mdx
@@ -153,7 +153,7 @@ const result = await composio.tools.execute('GITHUB_GET_ISSUES', {
Executes a composio meta tool based on tool router session
```typescript
-async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unknown>; sessionId: string }, modifiers?: ExecuteToolModifiers): Promise<...>
+async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unknown>; sessionId: string }, modifiers?: SessionExecuteMetaModifiers): Promise<...>
```
**Parameters**
@@ -162,7 +162,7 @@ async executeMetaTool(toolSlug: string, body: { arguments?: Record<string, unkno
|------|------|-------------|
| `toolSlug` | `string` | The slug of the tool to execute |
| `body` | `object` | The execution parameters |
-| `modifiers?` | `ExecuteToolModifiers` | The modifiers to apply to the tool |
+| `modifiers?` | `SessionExecuteMetaModifiers` | The modifiers to apply to the tool |
**Returns**
@@ -408,6 +408,36 @@ const authSpecificTools = await composio.tools.getRawComposioTools({
---
+### getRawToolRouterMetaTools()
+
+Fetches the meta tools for a tool router session.
+This method fetches the meta tools from the Composio API and transforms them to the expected format.
+It provides access to the underlying meta tool data without provider-specific wrapping.
+
+```typescript
+async getRawToolRouterMetaTools(sessionId: string, options?: SchemaModifierOptions): Promise<ToolList>
+```
+
+**Parameters**
+
+| Name | Type | Description |
+|------|------|-------------|
+| `sessionId` | `string` | \{string\} The session id to get the meta tools for |
+| `options?` | `SchemaModifierOptions` | \{SchemaModifierOptions\} Optional configuration for tool retrieval |
+
+**Returns**
+
+`Promise<ToolList>` — The list of meta tools
+
+**Example**
+
+```typescript
+const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123');
+console.log(metaTools);
+```
+
+---
+
### getToolsEnum()
Fetches the list of all available tools in the Composio SDK.
diff --git a/docs/content/reference/sdk-reference/typescript/triggers.mdx b/docs/content/reference/sdk-reference/typescript/triggers.mdx
index 1958155ed..1a455a3c7 100644
--- a/docs/content/reference/sdk-reference/typescript/triggers.mdx
+++ b/docs/content/reference/sdk-reference/typescript/triggers.mdx
@@ -262,11 +262,14 @@ async update(triggerId: string, body: { status: 'enable' | 'disable' }): Promise
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
+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`
+
```typescript
-verifyWebhook(params: { payload: string; secret: string; signature: string; tolerance?: number }): object
+verifyWebhook(params: object): VerifyWebhookResult
```
**Parameters**
@@ -277,7 +280,7 @@ verifyWebhook(params: { payload: string; secret: string; signature: string; tole
**Returns**
-`object` — The verified and parsed webhook payload
+`VerifyWebhookResult` — The verified and parsed webhook payload with version information
**Example**
@@ -285,14 +288,17 @@ verifyWebhook(params: { payload: string; secret: string; signature: string; tole
// In an Express.js webhook handler
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
try {
- const payload = composio.triggers.verifyWebhook({
+ const result = composio.triggers.verifyWebhook({
payload: req.body.toString(),
- signature: req.headers['x-composio-signature'] as string,
+ 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('Received trigger:', payload.triggerSlug);
+ 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);