Files
twenty/packages/twenty-apps/community/stripe-synchronizer
Charles Bochet c0cc0689d6 Add Client Api generation (#17961)
## Add API client generation to SDK dev mode and refactor orchestrator
into step-based pipeline

### Why

The SDK dev mode lacked typed API client generation, forcing developers
to work without auto-generated GraphQL types when building applications.
Additionally, the orchestrator was a monolithic class that mixed watcher
management, token handling, and sync logic — making it difficult to
extend with new steps like client generation.

### How

- **Refactored the orchestrator** into a step-based pipeline with
dedicated classes: `CheckServer`, `EnsureValidTokens`,
`ResolveApplication`, `BuildManifest`, `UploadFiles`,
`GenerateApiClient`, `SyncApplication`, and `StartWatchers`. Each step
has typed input/output/status, managed by a new `OrchestratorState`
class.
- **Added `GenerateApiClientOrchestratorStep`** that detects
object/field schema changes and regenerates a typed GraphQL client (via
`@genql/cli`) into `node_modules/twenty-sdk/generated` for seamless
imports.
- **Replaced `checkApplicationExist`** with `findOneApplication` on both
server resolver and SDK API service, returning the entity data instead
of a boolean.
- **Added application token pair mutations**
(`generateApplicationToken`, `renewApplicationToken`) to the API
service, with the server now returning `ApplicationTokenPairDTO`
containing both access and refresh tokens.
- **Restructured the dev UI** into `dev/ui/components/` with dedicated
panel, section, and event log components.
- **Simplified `AppDevCommand`** from ~180 lines of watcher management
down to ~40 lines that delegate entirely to the orchestrator.
2026-02-17 18:45:52 +01:00
..
2025-11-21 14:10:51 +01:00

Stripe synchronizer

Synchronizes customers from Stripe to Twenty

Requirements

  • an apiKey - go to Settings > API & Webhooks to generate one
  • Stripe secret API key - available in Stripe workbench

Setup

  1. Synchronize app
cd packages/twenty-apps/community/stripe-synchronizer
yarn auth
yarn sync
  1. Go to Stripe > Workbench > Webhooks and add webhook:
  1. Go to Twenty > Settings > Integrations > Stripe synchronizer > Settings and add values

Flow

  1. Retrieve Stripe webhook
  2. Check if it's either subscription created or updated, if not, exit
  3. Read customer ID, sub status and quantity from webhook
  4. Read customer data from Stripe API, if business name is empty, exit
  5. Check if customer company exists in Twenty, if not, create it
  6. Check if related person exists in Twenty, if not, create it and link to company

Notes

  • app synchronizes only new customers, those created before start of app won't be synchronized unless they're updated
  • customers will be added to Twenty People object only if their name and email are filled with data, otherwise app will throw an error

Todo

  • add validation of signature key from Stripe to ensure that incoming request is valid (possible once request headers are exposed to serverless functions)
  • update app so it'll use provided Twenty generated object with native types from workspace once extending objects is possible