Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | --- |
| 2 | title: 'SDK 0.6.0 Major Update: Cloudflare Workers Support and Breaking Changes' |
| 3 | description: 'Major release with Cloudflare Workers support, webhook verification updates, and Mastra v1 compatibility. Includes breaking changes for webhook APIs.' |
| 4 | date: '2026-01-29' |
| 5 | --- |
| 6 | |
| 7 | ## Version Information |
| 8 | |
| 9 | ### TypeScript/JavaScript |
| 10 | |
| 11 | - Package: `@composio/core` and all provider packages |
| 12 | - Version: `0.6.0`+ |
| 13 | |
| 14 | ### Python |
| 15 | |
| 16 | - Package: `composio` and all provider packages |
| 17 | - Version: `0.11.0`+ |
| 18 | |
| 19 | --- |
| 20 | |
| 21 | This major release focuses on Cloudflare Workers compatibility, platform-specific optimizations, and critical bug fixes. It includes **breaking changes** in both TypeScript and Python SDKs. |
| 22 | |
| 23 | <Callout type="warn"> |
| 24 | **Breaking Changes**: This release includes breaking changes that require code modifications: |
| 25 | |
| 26 | **TypeScript:** |
| 27 | |
| 28 | 1. Webhook verification: Now async + signature changed (must add `await` + new required params: `id`, `timestamp`) |
| 29 | 2. Mastra provider updated to v1 API |
| 30 | |
| 31 | **Python:** |
| 32 | |
| 33 | 1. Webhook verification: Signature changed (new required parameters: `id`, `timestamp` - still synchronous) |
| 34 | |
| 35 | See the [Migration Guide](#migration-guide) for detailed upgrade instructions. |
| 36 | |
| 37 | </Callout> |
| 38 | |
| 39 | ## Breaking Changes |
| 40 | |
| 41 | ### 1. Webhook Verification Breaking Changes |
| 42 | |
| 43 | **TypeScript PR**: [#2436](https://github.com/ComposioHQ/composio/pull/2436) | **Python PR**: [#2361](https://github.com/ComposioHQ/composio/pull/2361) |
| 44 | |
| 45 | The webhook verification API has breaking changes in both SDKs to support multiple webhook versions (v1, v2, v3) and edge runtime compatibility. |
| 46 | |
| 47 | #### TypeScript: Now Async + Signature Changed |
| 48 | |
| 49 | The `verifyWebhook()` method has **two breaking changes**: it's now async AND requires additional parameters. |
| 50 | |
| 51 | **Before:** |
| 52 | |
| 53 | ```typescript |
| 54 | // @noErrors |
| 55 | import { Composio } from '@composio/core'; |
| 56 | |
| 57 | const composio = new Composio(); |
| 58 | |
| 59 | // Old signature - synchronous, fewer parameters |
| 60 | const payload = composio.triggers.verifyWebhook({ |
| 61 | payload: req.body.toString(), |
| 62 | signature: req.headers['x-composio-signature'] as string, |
| 63 | secret: process.env.COMPOSIO_WEBHOOK_SECRET!, |
| 64 | }); |
| 65 | // Returns: TriggerEvent |
| 66 | ``` |
| 67 | |
| 68 | **After:** |
| 69 | |
| 70 | ```typescript |
| 71 | // @noErrors |
| 72 | import { Composio } from '@composio/core'; |
| 73 | |
| 74 | const composio = new Composio(); |
| 75 | |
| 76 | // New signature - async, requires id and timestamp |
| 77 | const result = await composio.triggers.verifyWebhook({ |
| 78 | id: req.headers['webhook-id'] as string, // NEW: required |
| 79 | payload: req.body.toString(), |
| 80 | secret: process.env.COMPOSIO_WEBHOOK_SECRET!, |
| 81 | signature: req.headers['webhook-signature'] as string, // header name changed |
| 82 | timestamp: req.headers['webhook-timestamp'] as string, // NEW: required |
| 83 | tolerance: 300, // optional, default 300 seconds |
| 84 | }); |
| 85 | // Returns: VerifyWebhookResult with version info |
| 86 | ``` |
| 87 | |
| 88 | **Key Changes:** |
| 89 | |
| 90 | - ⚠️ **Now async** - Must use `await` |
| 91 | - ⚠️ New required parameter: `id` (from `webhook-id` header) |
| 92 | - ⚠️ New required parameter: `timestamp` (from `webhook-timestamp` header) |
| 93 | - ⚠️ Header name changed: `x-composio-signature` → `webhook-signature` |
| 94 | - ⚠️ Return type changed: `TriggerEvent` → `VerifyWebhookResult` |
| 95 | |
| 96 | **Why?** |
| 97 | |
| 98 | - Cloudflare Workers compatibility - uses Web Crypto API instead of `node:crypto` |
| 99 | - Supports v1, v2, and v3 webhook formats with improved signature verification |
| 100 | |
| 101 | --- |
| 102 | |
| 103 | #### Python: Signature Changed (v1/v2/v3 Support) |
| 104 | |
| 105 | The method signature changed to support new webhook versions and requires additional headers. |
| 106 | |
| 107 | **Before:** |
| 108 | |
| 109 | ```python |
| 110 | from composio import Composio |
| 111 | |
| 112 | composio = Composio() |
| 113 | |
| 114 | # Old signature - fewer parameters |
| 115 | event = composio.triggers.verify_webhook( |
| 116 | payload=request.get_data(as_text=True), |
| 117 | signature=request.headers.get('x-composio-signature'), |
| 118 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 119 | ) |
| 120 | # Returns: TriggerEvent |
| 121 | ``` |
| 122 | |
| 123 | **After:** |
| 124 | |
| 125 | ```python |
| 126 | from composio import Composio |
| 127 | |
| 128 | composio = Composio() |
| 129 | |
| 130 | # New signature - requires id and timestamp headers |
| 131 | result = composio.triggers.verify_webhook( |
| 132 | id=request.headers.get('webhook-id'), # NEW: required |
| 133 | payload=request.get_data(as_text=True), |
| 134 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 135 | signature=request.headers.get('webhook-signature'), # header name changed |
| 136 | timestamp=request.headers.get('webhook-timestamp'), # NEW: required |
| 137 | tolerance=300, # optional |
| 138 | ) |
| 139 | # Returns: VerifyWebhookResult with version info |
| 140 | ``` |
| 141 | |
| 142 | **Key Changes:** |
| 143 | |
| 144 | - ✅ **Still synchronous** (no `await` needed) |
| 145 | - ⚠️ New required parameter: `id` (webhook-id header) |
| 146 | - ⚠️ New required parameter: `timestamp` (webhook-timestamp header) |
| 147 | - ⚠️ Header name changed: `x-composio-signature` → `webhook-signature` |
| 148 | - ⚠️ Return type changed: `TriggerEvent` → `VerifyWebhookResult` |
| 149 | - ⚠️ All parameters now keyword-only (must use `param=value`) |
| 150 | |
| 151 | **Why?** Supports v1, v2, and v3 webhook formats with improved signature verification. |
| 152 | |
| 153 | --- |
| 154 | |
| 155 | ### 2. Mastra v1 Provider Update |
| 156 | |
| 157 | **PR**: [#2433](https://github.com/ComposioHQ/composio/pull/2433) |
| 158 | |
| 159 | The `@composio/mastra` provider has been updated to support Mastra v1, which has breaking API changes from v0.x. |
| 160 | |
| 161 | #### Before (Mastra v0.x) |
| 162 | |
| 163 | ```typescript |
| 164 | // @noErrors |
| 165 | import { MastraProvider } from '@composio/mastra'; |
| 166 | import { Mastra } from '@mastra/core'; |
| 167 | |
| 168 | const mastra = new Mastra({ |
| 169 | /* v0 config */ |
| 170 | }); |
| 171 | const provider = new MastraProvider(); |
| 172 | |
| 173 | // v0 API usage |
| 174 | const tools = await provider.wrapTools(composioTools); |
| 175 | ``` |
| 176 | |
| 177 | #### After (Mastra v1) |
| 178 | |
| 179 | ```typescript |
| 180 | // @noErrors |
| 181 | import { MastraProvider } from '@composio/mastra'; |
| 182 | import { Mastra } from '@mastra/core'; |
| 183 | |
| 184 | const mastra = new Mastra({ |
| 185 | /* v1 config */ |
| 186 | }); |
| 187 | const provider = new MastraProvider({ mastra }); |
| 188 | |
| 189 | // v1 API - different tool format |
| 190 | const tools = await provider.wrapTools(composioTools); |
| 191 | ``` |
| 192 | |
| 193 | #### Changes Required |
| 194 | |
| 195 | 1. **Update Mastra dependency**: `npm install @mastra/core@latest` |
| 196 | 2. **Update provider initialization**: Pass Mastra instance to provider |
| 197 | 3. **Update tool handling**: Mastra v1 uses different tool schema format |
| 198 | 4. **Check Zod version**: Mastra v1 supports both Zod v3 and v4 |
| 199 | 5. **Check Node.js version**: Mastra v1 requires [Node.js v22.13.0](https://mastra.ai/guides/migrations/upgrade-to-v1/overview#update-nodejs-version) or higher |
| 200 | |
| 201 | <Callout type="info"> |
| 202 | We've added comprehensive E2E tests for both Zod v3 and v4 compatibility with Mastra v1 and Tool |
| 203 | Router integration. |
| 204 | </Callout> |
| 205 | |
| 206 | --- |
| 207 | |
| 208 | ## Major Features |
| 209 | |
| 210 | ### 3. Platform-Specific File Tool Modifier |
| 211 | |
| 212 | **PR**: [#2437](https://github.com/ComposioHQ/composio/pull/2437) |
| 213 | |
| 214 | Separate implementations for Node.js and Cloudflare Workers to optimize file handling for each runtime. |
| 215 | |
| 216 | **Key Improvements:** |
| 217 | |
| 218 | - **Node.js**: Uses native file system APIs for better performance |
| 219 | - **Cloudflare Workers**: Uses platform-specific APIs, avoids Node.js-only code |
| 220 | - **Automatic selection**: SDK automatically picks the right implementation |
| 221 | - **No code changes needed**: Works transparently |
| 222 | |
| 223 | <Callout type="info"> |
| 224 | **Related Change**: This platform-agnostic approach is why `composio.triggers.verifyWebhook()` became async in [Breaking Change #1](#1-webhook-verification-breaking-changes). Node.js `node:crypto` is mostly synchronous, but the standard `globalThis.crypto` (Web Crypto API) available in Cloudflare Workers is async. To support both platforms with a single API, the method had to become async. |
| 225 | </Callout> |
| 226 | |
| 227 | --- |
| 228 | |
| 229 | ### 4. Platform-Specific Config Defaults |
| 230 | |
| 231 | **PR**: [#2437](https://github.com/ComposioHQ/composio/pull/2437) |
| 232 | |
| 233 | Different default configurations for different runtimes to optimize behavior. |
| 234 | |
| 235 | Changed the `autoUploadDownloadFiles` default configuration for the Cloudflare Workers runtime, to avoid triggering runtime errors on unsupported features. |
| 236 | |
| 237 | **Cloudflare Workers defaults:** |
| 238 | |
| 239 | ```typescript |
| 240 | { |
| 241 | autoUploadDownloadFiles: false; // We don't currently support file uploads/downloads in Cloudflare Workers |
| 242 | } |
| 243 | ``` |
| 244 | |
| 245 | <Callout type="warn"> |
| 246 | **Removed in a later release.** The `autoUploadDownloadFiles` flag described above was removed in the v0.8.0 / Python v0.12.0 release train. Automatic file handling is now off by default on every runtime, and you opt in with `dangerouslyAllowAutoUploadDownloadFiles` instead. See [SDKs remove legacy automatic file handling config](/docs/changelog/2026/04/24) for the full migration. |
| 247 | </Callout> |
| 248 | |
| 249 | **Benefits:** |
| 250 | |
| 251 | - **Zero config** for common use cases |
| 252 | - **Optimized** for each platform's strengths |
| 253 | - **Override** defaults when needed |
| 254 | |
| 255 | --- |
| 256 | |
| 257 | ### 5. Node Buffer → Uint8Array Refactoring |
| 258 | |
| 259 | **PR**: [#2438](https://github.com/ComposioHQ/composio/pull/2438) |
| 260 | |
| 261 | All `node:buffer` usage replaced with standard `Uint8Array` for universal compatibility. |
| 262 | |
| 263 | **Impact:** |
| 264 | |
| 265 | - Works in **Node.js and Cloudflare Workers** |
| 266 | - **ESLint rules** enforce this pattern going forward |
| 267 | - **Better type safety** with standard types |
| 268 | - **Fully backward compatible** - no code changes needed |
| 269 | |
| 270 | <Callout type="info"> |
| 271 | **Why This Matters**: Removing Node.js-specific APIs like `node:buffer` and `node:crypto` enables Cloudflare Workers support. Cloudflare Workers don't have access to Node.js built-in modules, so we use Web Standard APIs (`Uint8Array`, `globalThis.crypto`) that work in both Node.js and Cloudflare Workers. |
| 272 | </Callout> |
| 273 | |
| 274 | --- |
| 275 | |
| 276 | ## Bug Fixes |
| 277 | |
| 278 | ### 6. Tool Fetching with Specific Version |
| 279 | |
| 280 | **PR**: [#2518](https://github.com/ComposioHQ/composio/pull/2518) |
| 281 | |
| 282 | Fixed issues when executing tools with version constraints. |
| 283 | |
| 284 | #### Before (Bug) |
| 285 | |
| 286 | ```typescript |
| 287 | // @noErrors |
| 288 | // This would fail or fetch wrong version |
| 289 | await composio.tools.execute('GITHUB_CREATE_ISSUE', { |
| 290 | userId: 'user_123', |
| 291 | version: '1.2.0', // Version constraint ignored |
| 292 | arguments: { |
| 293 | /* ... */ |
| 294 | }, |
| 295 | }); |
| 296 | ``` |
| 297 | |
| 298 | #### After (Fixed) |
| 299 | |
| 300 | ```typescript |
| 301 | // @noErrors |
| 302 | // Now correctly respects version constraint |
| 303 | await composio.tools.execute('GITHUB_CREATE_ISSUE', { |
| 304 | userId: 'user_123', |
| 305 | version: '1.2.0', // Version constraint honored |
| 306 | arguments: { |
| 307 | /* ... */ |
| 308 | }, |
| 309 | }); |
| 310 | ``` |
| 311 | |
| 312 | **Test Coverage**: Added 174 new test cases to prevent regression. |
| 313 | |
| 314 | --- |
| 315 | |
| 316 | ### 7. Python JSON Schema Default Values |
| 317 | |
| 318 | **PR**: [#2506](https://github.com/ComposioHQ/composio/pull/2506) |
| 319 | |
| 320 | Fixed type coercion for stringified default values in JSON schemas. |
| 321 | |
| 322 | #### Before (Bug) |
| 323 | |
| 324 | ```python |
| 325 | # Schema with stringified default |
| 326 | { |
| 327 | "type": "integer", |
| 328 | "default": "42" # String instead of int |
| 329 | } |
| 330 | |
| 331 | # Would cause runtime errors |
| 332 | ``` |
| 333 | |
| 334 | #### After (Fixed) |
| 335 | |
| 336 | ```python |
| 337 | # SDK automatically coerces to correct type |
| 338 | { |
| 339 | "type": "integer", |
| 340 | "default": 42 # Properly coerced to int |
| 341 | } |
| 342 | |
| 343 | # Works correctly |
| 344 | ``` |
| 345 | |
| 346 | **Impact**: Fixes runtime errors with tools that have stringified defaults in their schemas. |
| 347 | |
| 348 | --- |
| 349 | |
| 350 | ### 8. Salesforce Type Error Fix |
| 351 | |
| 352 | **PR**: [#2426](https://github.com/ComposioHQ/composio/pull/2426) |
| 353 | |
| 354 | Fixed `SALESFORCE_CREATE_LEAD` type error with `custom_fields` parameter. |
| 355 | |
| 356 | #### Before (Bug) |
| 357 | |
| 358 | ```python |
| 359 | # Would fail with type error |
| 360 | composio.tools.execute('SALESFORCE_CREATE_LEAD', { |
| 361 | 'user_id': 'user_123', |
| 362 | 'arguments': { |
| 363 | 'custom_fields': { |
| 364 | 'CustomField__c': 'value' |
| 365 | } |
| 366 | } |
| 367 | }) |
| 368 | ``` |
| 369 | |
| 370 | #### After (Fixed) |
| 371 | |
| 372 | ```python |
| 373 | # Now works correctly |
| 374 | composio.tools.execute('SALESFORCE_CREATE_LEAD', { |
| 375 | 'user_id': 'user_123', |
| 376 | 'arguments': { |
| 377 | 'custom_fields': { |
| 378 | 'CustomField__c': 'value' |
| 379 | } |
| 380 | } |
| 381 | }) |
| 382 | ``` |
| 383 | |
| 384 | **Technical Details**: Implemented proper support for `anyOf` and `allOf` JSON Schema constructs in Python SDK. |
| 385 | |
| 386 | --- |
| 387 | |
| 388 | ## Migration Guide |
| 389 | |
| 390 | ### Step 1: Update Dependencies |
| 391 | |
| 392 | <Tabs groupId="package-manager" items={['npm', 'pnpm', 'yarn', 'pip', 'uv']} persist> |
| 393 | <Tab value="npm"> |
| 394 | ```bash npm update @composio/core@latest # Update provider packages if using them npm update |
| 395 | @composio/openai@latest npm update @composio/anthropic@latest npm update @composio/vercel@latest |
| 396 | # etc. ``` |
| 397 | </Tab> |
| 398 | <Tab value="pnpm"> |
| 399 | ```bash pnpm update @composio/core@latest # Update provider packages if using them pnpm update |
| 400 | @composio/openai@latest pnpm update @composio/anthropic@latest pnpm update |
| 401 | @composio/vercel@latest # etc. ``` |
| 402 | </Tab> |
| 403 | <Tab value="yarn"> |
| 404 | ```bash yarn upgrade @composio/core@latest # Update provider packages if using them yarn upgrade |
| 405 | @composio/openai@latest yarn upgrade @composio/anthropic@latest yarn upgrade |
| 406 | @composio/vercel@latest # etc. ``` |
| 407 | </Tab> |
| 408 | <Tab value="pip">```bash pip install --upgrade composio ```</Tab> |
| 409 | <Tab value="uv">```bash uv pip install --upgrade composio ```</Tab> |
| 410 | </Tabs> |
| 411 | |
| 412 | --- |
| 413 | |
| 414 | ### Step 2: Update Webhook Verification (Required) |
| 415 | |
| 416 | <Tabs groupId="language" items={['TypeScript', 'Python']} persist> |
| 417 | <Tab value="TypeScript"> |
| 418 | |
| 419 | **Update signature with new parameters and add `await`:** |
| 420 | |
| 421 | ```typescript |
| 422 | // @noErrors |
| 423 | // Before - old signature |
| 424 | const payload = composio.triggers.verifyWebhook({ |
| 425 | payload: req.body.toString(), |
| 426 | signature: req.headers['x-composio-signature'] as string, |
| 427 | secret: process.env.COMPOSIO_WEBHOOK_SECRET!, |
| 428 | }); |
| 429 | |
| 430 | // After - new signature with await and additional parameters |
| 431 | const result = await composio.triggers.verifyWebhook({ |
| 432 | id: req.headers['webhook-id'] as string, // NEW |
| 433 | payload: req.body.toString(), |
| 434 | secret: process.env.COMPOSIO_WEBHOOK_SECRET!, |
| 435 | signature: req.headers['webhook-signature'] as string, // header name changed |
| 436 | timestamp: req.headers['webhook-timestamp'] as string, // NEW |
| 437 | }); |
| 438 | |
| 439 | // Access the normalized payload and version info |
| 440 | const event = result.payload; |
| 441 | const version = result.version; // 'V1', 'V2', or 'V3' |
| 442 | ``` |
| 443 | |
| 444 | **Express.js Example:** |
| 445 | |
| 446 | ```typescript |
| 447 | // @noErrors |
| 448 | import express from 'express'; |
| 449 | import { Composio } from '@composio/core'; |
| 450 | |
| 451 | const app = express(); |
| 452 | const composio = new Composio(); |
| 453 | |
| 454 | // Make route handler async |
| 455 | app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => { |
| 456 | try { |
| 457 | // New signature with all required headers |
| 458 | const result = await composio.triggers.verifyWebhook({ |
| 459 | id: req.headers['webhook-id'] as string, |
| 460 | payload: req.body.toString(), |
| 461 | secret: process.env.COMPOSIO_WEBHOOK_SECRET!, |
| 462 | signature: req.headers['webhook-signature'] as string, |
| 463 | timestamp: req.headers['webhook-timestamp'] as string, |
| 464 | }); |
| 465 | |
| 466 | // Access verified webhook data |
| 467 | console.log('Webhook version:', result.version); |
| 468 | console.log('Received trigger:', result.payload.triggerSlug); |
| 469 | |
| 470 | res.status(200).send('OK'); |
| 471 | } catch (error) { |
| 472 | console.error('Webhook verification failed:', error); |
| 473 | res.status(401).send('Unauthorized'); |
| 474 | } |
| 475 | }); |
| 476 | ``` |
| 477 | |
| 478 | **Cloudflare Workers Example:** |
| 479 | |
| 480 | ```typescript |
| 481 | // @noErrors |
| 482 | import { Composio } from '@composio/core'; |
| 483 | |
| 484 | export default { |
| 485 | async fetch(request: Request, env: Env): Promise<Response> { |
| 486 | const composio = new Composio({ apiKey: env.COMPOSIO_API_KEY }); |
| 487 | |
| 488 | try { |
| 489 | const body = await request.text(); |
| 490 | |
| 491 | // Now works in Cloudflare Workers! |
| 492 | const result = await composio.triggers.verifyWebhook({ |
| 493 | id: request.headers.get('webhook-id') || '', |
| 494 | payload: body, |
| 495 | secret: env.COMPOSIO_WEBHOOK_SECRET, |
| 496 | signature: request.headers.get('webhook-signature') || '', |
| 497 | timestamp: request.headers.get('webhook-timestamp') || '', |
| 498 | }); |
| 499 | |
| 500 | // Process verified webhook |
| 501 | console.log('Trigger:', result.payload.triggerSlug); |
| 502 | |
| 503 | return new Response('OK', { status: 200 }); |
| 504 | } catch (error) { |
| 505 | return new Response('Unauthorized', { status: 401 }); |
| 506 | } |
| 507 | }, |
| 508 | }; |
| 509 | ``` |
| 510 | |
| 511 | </Tab> |
| 512 | <Tab value="Python"> |
| 513 | |
| 514 | **Update signature to include new required parameters:** |
| 515 | |
| 516 | ```python |
| 517 | # Before - old signature |
| 518 | event = composio.triggers.verify_webhook( |
| 519 | payload=request.get_data(as_text=True), |
| 520 | signature=request.headers.get('x-composio-signature'), |
| 521 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 522 | ) |
| 523 | |
| 524 | # After - new signature with additional parameters |
| 525 | result = composio.triggers.verify_webhook( |
| 526 | id=request.headers.get('webhook-id'), # NEW |
| 527 | payload=request.get_data(as_text=True), |
| 528 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 529 | signature=request.headers.get('webhook-signature'), # header name changed |
| 530 | timestamp=request.headers.get('webhook-timestamp'), # NEW |
| 531 | ) |
| 532 | |
| 533 | # Access the normalized payload |
| 534 | event = result['payload'] |
| 535 | # Check webhook version |
| 536 | version = result['version'] # 'V1', 'V2', or 'V3' |
| 537 | ``` |
| 538 | |
| 539 | **FastAPI Example:** |
| 540 | |
| 541 | ```python |
| 542 | from fastapi import FastAPI, Request, HTTPException |
| 543 | from composio import Composio |
| 544 | import os |
| 545 | |
| 546 | app = FastAPI() |
| 547 | composio = Composio() |
| 548 | |
| 549 | @app.post("/webhook") |
| 550 | def webhook(request: Request): # Still synchronous! |
| 551 | # New signature with all required headers |
| 552 | try: |
| 553 | result = composio.triggers.verify_webhook( |
| 554 | id=request.headers.get('webhook-id', ''), |
| 555 | payload=request.body().decode('utf-8'), |
| 556 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 557 | signature=request.headers.get('webhook-signature', ''), |
| 558 | timestamp=request.headers.get('webhook-timestamp', ''), |
| 559 | ) |
| 560 | |
| 561 | # Access normalized payload and version info |
| 562 | print(f"Webhook version: {result['version']}") |
| 563 | print(f"Trigger: {result['payload']['trigger_slug']}") |
| 564 | |
| 565 | return {"success": True} |
| 566 | except Exception as e: |
| 567 | raise HTTPException(status_code=401, detail=str(e)) |
| 568 | ``` |
| 569 | |
| 570 | **Flask Example:** |
| 571 | |
| 572 | ```python |
| 573 | from flask import Flask, request |
| 574 | from composio import Composio |
| 575 | import os |
| 576 | |
| 577 | app = Flask(__name__) |
| 578 | composio = Composio() |
| 579 | |
| 580 | @app.route('/webhook', methods=['POST']) |
| 581 | def webhook(): # Still synchronous! |
| 582 | try: |
| 583 | result = composio.triggers.verify_webhook( |
| 584 | id=request.headers.get('webhook-id', ''), |
| 585 | payload=request.get_data(as_text=True), |
| 586 | secret=os.environ['COMPOSIO_WEBHOOK_SECRET'], |
| 587 | signature=request.headers.get('webhook-signature', ''), |
| 588 | timestamp=request.headers.get('webhook-timestamp', ''), |
| 589 | ) |
| 590 | |
| 591 | # Process verified webhook |
| 592 | event = result['payload'] |
| 593 | return 'OK', 200 |
| 594 | except Exception as e: |
| 595 | return 'Unauthorized', 401 |
| 596 | ``` |
| 597 | |
| 598 | </Tab> |
| 599 | </Tabs> |
| 600 | |
| 601 | --- |
| 602 | |
| 603 | ### Step 3: Update Mastra Integration (If Using) |
| 604 | |
| 605 | **Only required if you use `@composio/mastra` provider** |
| 606 | |
| 607 | <Tabs groupId="package-manager" items={['npm', 'pnpm', 'yarn']} persist> |
| 608 | <Tab value="npm"> |
| 609 | ```bash # Update to Mastra v1 npm install @mastra/core@latest @composio/mastra@latest ``` |
| 610 | </Tab> |
| 611 | <Tab value="pnpm">```bash pnpm update @mastra/core@latest @composio/mastra@latest ```</Tab> |
| 612 | <Tab value="yarn">```bash yarn upgrade @mastra/core@latest @composio/mastra@latest ```</Tab> |
| 613 | </Tabs> |
| 614 | |
| 615 | **Update your code:** |
| 616 | |
| 617 | ```typescript |
| 618 | // @noErrors |
| 619 | // Before |
| 620 | import { MastraProvider } from '@composio/mastra'; |
| 621 | |
| 622 | const provider = new MastraProvider(); |
| 623 | |
| 624 | // After |
| 625 | import { MastraProvider } from '@composio/mastra'; |
| 626 | import { Mastra } from '@mastra/core'; |
| 627 | |
| 628 | const mastra = new Mastra({ |
| 629 | // Your Mastra v1 config |
| 630 | }); |
| 631 | |
| 632 | const provider = new MastraProvider({ mastra }); |
| 633 | ``` |
| 634 | |
| 635 | <Callout type="info"> |
| 636 | **Zod Compatibility**: Mastra v1 works with both Zod v3 and v4. We test both versions in CI to |
| 637 | ensure compatibility. |
| 638 | </Callout> |
| 639 | |
| 640 | --- |
| 641 | |
| 642 | ### Step 4: Test Your Integration |
| 643 | |
| 644 | 1. **Run your test suite** to catch any issues |
| 645 | 2. **Test webhook verification** if you use triggers |
| 646 | 3. **Test file uploads/downloads** - behavior improved but API unchanged |
| 647 | 4. **Test in your target runtime** (Node.js, Cloudflare Workers, etc.) |
| 648 | |
| 649 | --- |
| 650 | |
| 651 | ## Backward Compatibility |
| 652 | |
| 653 | ### Fully Compatible (No Changes Needed) |
| 654 | |
| 655 | The following features work without any code changes: |
| 656 | |
| 657 | - ✅ All tool execution APIs |
| 658 | - ✅ Connected accounts management |
| 659 | - ✅ Authentication flows |
| 660 | - ✅ Custom tools |
| 661 | - ✅ Tool Router sessions |
| 662 | - ✅ File upload/download (API unchanged, implementation improved) |
| 663 | - ✅ All provider packages (except Mastra) |
| 664 | - ✅ Python SDK usage (except webhook verification) |
| 665 | |
| 666 | ### Requires Changes |
| 667 | |
| 668 | The following features require code updates: |
| 669 | |
| 670 | - ⚠️ **Webhook verification (TypeScript)** - Must add `await` AND add `id` + `timestamp` parameters, update header names |
| 671 | - ⚠️ **Webhook verification (Python)** - Must add `id` + `timestamp` parameters, update header names (still synchronous) |
| 672 | - ⚠️ **Mastra integration (TypeScript only)** - Must update to v1 API |
| 673 | |
| 674 | --- |
| 675 | |
| 676 | ## Impact Summary |
| 677 | |
| 678 | | Change | TypeScript Breaking | Python Breaking | Migration Required | Effort | |
| 679 | | --------------------------------- | -------------------------- | ----------------------- | ---------------------- | ----------------------------- | |
| 680 | | Webhook verification - TypeScript | ✅ Yes (async + signature) | N/A | ✅ Required | Medium - Add `await` + params | |
| 681 | | Webhook verification - Python | N/A | ✅ Yes (signature only) | ✅ Required | Low - Add parameters | |
| 682 | | Mastra v1 support | ✅ Yes | N/A | ✅ Required (if using) | Medium - Update API | |
| 683 | | Platform-specific file modifier | ❌ No | ❌ No | ❌ Optional | None - Automatic | |
| 684 | | Config defaults | ❌ No | ❌ No | ❌ Optional | None - Automatic | |
| 685 | | Buffer → Uint8Array | ❌ No | N/A | ❌ Optional | None - Automatic | |
| 686 | | Tool version fix | ❌ No | ❌ No | ❌ Optional | None - Automatic | |
| 687 | | JSON schema coercion | ❌ No | ❌ No | ❌ Optional | None - Automatic | |
| 688 | | Salesforce type fix | ❌ No | ❌ No | ❌ Optional | None - Automatic | |
| 689 | |
| 690 | --- |
| 691 | |
| 692 | ## Cloudflare Workers Support |
| 693 | |
| 694 | This release adds support for Cloudflare Workers: |
| 695 | |
| 696 | ```typescript |
| 697 | // @noErrors |
| 698 | import { Composio } from '@composio/core'; |
| 699 | |
| 700 | export default { |
| 701 | async fetch(request: Request, env: Env): Promise<Response> { |
| 702 | const composio = new Composio({ |
| 703 | apiKey: env.COMPOSIO_API_KEY, |
| 704 | }); |
| 705 | |
| 706 | // SDK now works in Cloudflare Workers! |
| 707 | const tools = await composio.tools.get('user_123', { |
| 708 | toolkits: ['github'], |
| 709 | }); |
| 710 | |
| 711 | const result = await composio.tools.execute('GITHUB_CREATE_ISSUE', { |
| 712 | userId: 'user_123', |
| 713 | arguments: { |
| 714 | /* ... */ |
| 715 | }, |
| 716 | }); |
| 717 | |
| 718 | return new Response(JSON.stringify(result)); |
| 719 | }, |
| 720 | }; |
| 721 | ``` |
| 722 | |
| 723 | **Key Features Working in Cloudflare Workers:** |
| 724 | - ✅ Tool execution |
| 725 | - ✅ Connected accounts |
| 726 | - ✅ Webhook verification |
| 727 | - ✅ File upload/download |
| 728 | - ✅ Custom tools |
| 729 | |
| 730 | --- |
| 731 | |
| 732 | ## Testing |
| 733 | |
| 734 | This release includes extensive E2E testing: |
| 735 | |
| 736 | - ✅ **Node.js**: Both CJS and ESM compatibility tests |
| 737 | - ✅ **Cloudflare Workers**: Multiple test suites including Tool Router |
| 738 | - ✅ **Mastra v1**: Tests for both Zod v3 and v4 |
| 739 | - ✅ **File handling**: Comprehensive tests for all platforms |
| 740 | - ✅ **Webhook verification**: Tests for all supported runtimes |
| 741 | |
| 742 | **Total new tests**: 200+ test cases added across TypeScript and Python SDKs. |
| 743 | |
| 744 | --- |
| 745 | |
| 746 | ## Getting Help |
| 747 | |
| 748 | If you encounter issues during migration: |
| 749 | |
| 750 | 1. **Check the docs**: [docs.composio.dev](https://docs.composio.dev) |
| 751 | 2. **Join our Discord**: [discord.composio.dev](https://discord.composio.dev) |
| 752 | 3. **Open an issue**: [github.com/ComposioHQ/composio/issues](https://github.com/ComposioHQ/composio/issues) |
| 753 | 4. **Email support**: [support@composio.dev](mailto:support@composio.dev) |
| 754 | |
| 755 | --- |
| 756 | |
| 757 | ## What's Next |
| 758 | |
| 759 | Future releases will focus on: |
| 760 | |
| 761 | - 🚀 Performance optimizations |
| 762 | - 🔧 More platform-specific improvements |
| 763 | - 📚 Enhanced TypeScript types |
| 764 | - 🛠️ New tool integrations |
| 765 | - 🔐 Advanced authentication flows |
| 766 | |
| 767 | Stay tuned for updates! |