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.

fix(fumadocs): add Twoslash setup for core docs

Sushmithamalleshaa2b0d13c5fc
diff --git a/fumadocs/content/docs/toolkit-versioning.mdx b/fumadocs/content/docs/toolkit-versioning.mdx
index 1959e73f6..ee6709fa1 100644
--- a/fumadocs/content/docs/toolkit-versioning.mdx
+++ b/fumadocs/content/docs/toolkit-versioning.mdx
@@ -150,9 +150,8 @@ const toolkit = await composio.toolkits.get("github");
// Extract and print version information
console.log("Toolkit:", toolkit.name);
-console.log("Current Version:", toolkit.meta.version);
console.log("Available Versions:", toolkit.meta.availableVersions);
-console.log("Latest Version:", toolkit.meta.availableVersions[0]); // First one is usually the latest
+console.log("Latest Version:", toolkit.meta.availableVersions?.[0]);
```
</Tab>
</Tabs>
diff --git a/fumadocs/content/docs/user-management.mdx b/fumadocs/content/docs/user-management.mdx
index a7fcf4eff..6b9f9dcc3 100644
--- a/fumadocs/content/docs/user-management.mdx
+++ b/fumadocs/content/docs/user-management.mdx
@@ -59,6 +59,10 @@ result = composio.tools.execute(
</Tab>
<Tab value="TypeScript">
```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'your_api_key' });
+declare const user: { id: string };
+// ---cut---
// Use your database's user ID (UUID, primary key, etc.)
const userId = user.id; // e.g., "550e8400-e29b-41d4-a716-446655440000"
@@ -112,6 +116,10 @@ result = composio.tools.execute(
</Tab>
<Tab value="TypeScript">
```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'your_api_key' });
+declare const organization: { id: string };
+// ---cut---
// Use the organization ID as userId
const userId = organization.id; // e.g., "org_550e8400"
@@ -157,6 +165,11 @@ In B2B applications, typically an admin connects accounts once and all team memb
- Permission checks ensure users can only access their organization's connections
```typescript
+import { ConnectionRequest } from '@composio/core';
+declare function storeConnectionRequest(orgId: string, adminId: string, req: ConnectionRequest): Promise<void>;
+declare function userCanSendMessages(userId: string, orgId: string): Promise<boolean>;
+declare const app: { post: (path: string, handler: (req: any, res: any) => Promise<any>) => void };
+// ---cut---
import { Composio } from '@composio/core';
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
@@ -220,6 +233,8 @@ In B2C applications, each user connects and manages their own accounts. Every us
- No permission checks needed since users only access their own data
```typescript
+declare const app: { get: (path: string, handler: (req: any, res: any) => Promise<any>) => void };
+// ---cut---
import { Composio } from '@composio/core';
const composio = new Composio({
apiKey: process.env.COMPOSIO_API_KEY,
@@ -294,6 +309,10 @@ org_shared_tools = composio.tools.get(
</Tab>
<Tab value="TypeScript">
```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'your_api_key' });
+declare const req: { user: { id: string; organizationId: string } };
+// ---cut---
// Wrong: Using individual user ID for org-connected tool
const userTools = await composio.tools.get(req.user.id, {
toolkits: ['slack'], // Fails - Slack is connected at org level
diff --git a/fumadocs/content/docs/using-triggers.mdx b/fumadocs/content/docs/using-triggers.mdx
index 47404fdac..30ea0397e 100644
--- a/fumadocs/content/docs/using-triggers.mdx
+++ b/fumadocs/content/docs/using-triggers.mdx
@@ -136,6 +136,11 @@ async def webhook_handler(request: Request):
</Tab>
<Tab value="TypeScript">
```typescript
+import { TriggerEvent } from '@composio/core';
+type NextApiRequest = { body: any };
+type NextApiResponse = { status: (code: number) => { json: (data: any) => void }; json: (data: any) => void };
+type GitHubStarEventData = { repository_name: string; starred_by: string };
+// ---cut---
export default async function webhookHandler(req: NextApiRequest, res: NextApiResponse) {
const payload = req.body;
@@ -203,6 +208,9 @@ def verify_webhook_signature(request: Request, body: bytes) -> bool:
</Tab>
<Tab value="TypeScript">
```typescript
+import crypto from 'crypto';
+type NextApiRequest = { headers: Record<string, string | undefined> };
+// ---cut---
function verifyWebhookSignature(
req: NextApiRequest,
body: string
@@ -302,6 +310,9 @@ print(trigger.payload)
</Tab>
<Tab value="TypeScript">
```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'your_api_key' });
+// ---cut---
// Get trigger type to inspect payload structure
const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');
console.log(triggerType.payload);
@@ -357,6 +368,9 @@ composio.triggers.enable(trigger_id="ti_abcd123")
</Tab>
<Tab value="TypeScript">
```typescript
+import { Composio } from '@composio/core';
+const composio = new Composio({ apiKey: 'your_api_key' });
+// ---cut---
// Disable a trigger
await composio.triggers.disable('ti_abcd123');