Files
twenty/packages/twenty-docs
Abdul Rahman 3a646ffcb0 feat(connections): add an onDisconnect lifecycle hook to connection providers (#23538)
Platform half of the follow-up to
https://github.com/twentyhq/twenty/pull/22984#discussion_r3673946334.
The Slack app claims a `team_id` on connect and had no way to release
it, because connection providers only had an on-connect hook. Nothing
here is Slack-specific, so it targets `main`. The app side is #23540, on
top of `feat/slack-bot`, and waits on this plus an SDK release.

## What changes

`defineConnectionProvider` accepts `onDisconnectLogicFunction` alongside
`onConnectLogicFunction`. It is stored on
`connectionProvider.onDisconnectLogicFunctionUniversalIdentifier` (fast
instance command `2.26.0_...1785350000000`) and enqueued right after the
`ConnectedAccount` row is deleted, in the disconnecting workspace, with
the same payload as on-connect:

```ts
type OnDisconnectPayload = {
  connectionProviderId: string;
  connectionProviderName: string;
  connectedAccountId: string;
};
```

The `ConnectedAccount` is gone by the time the hook runs, so
`getConnection` no longer resolves. Anything the cleanup needs has to be
in the key-value store, written at connect time and keyed by
`connectedAccountId`. The docs section spells that out, along with the
fact that uninstalling an app drops its connections through a cascade
that never reaches this hook, where `uninstallLogicFunction` is the
right tool instead.

Both dispatches moved into a new
`ConnectionProviderLifecycleHookService`, so
`ConnectionProviderOAuthFlowService` no longer owns hook plumbing and
`ConnectedAccountMetadataService.delete` can reuse it. On-connect
behaviour is unchanged: best effort, never blocks the caller, failures
go to Sentry.

## Tests

- `connection-provider-lifecycle-hook.service.spec.ts`: the on-connect
cases moved over, plus on-disconnect dispatch, no-hook, and
missing-provider cases
- `connection-provider-oauth-flow.service.spec.ts`: now asserts
delegation to the lifecycle hook service
- SDK validation, manifest duplicate-identifier, and manifest to flat
converter specs extended

Server unit tests and typecheck for shared, sdk and server pass locally.
2026-08-04 02:47:23 +00:00
..
2026-07-21 17:39:39 +02:00
2026-08-03 21:07:03 +02:00
2026-07-28 16:37:49 +00:00

Twenty Documentation

Official documentation for Twenty CRM, powered by Mintlify.

🌐 Live Site

Visit the documentation at docs.twenty.com

📚 Content

This repository contains:

  • User Guide (46 pages) - Complete guide for Twenty users
  • Developers (24 pages) - Technical documentation for developers
  • Twenty UI (25 pages) - UI component library documentation

🚀 Local Development

To run the documentation locally:

# From the twenty monorepo root
npx nx run twenty-docs:dev

The documentation will be available at http://localhost:3000

📝 Editing Content

Adding/Editing Pages

  1. Edit MDX files in the appropriate directory:

    • user-guide/ - User documentation
    • developers/ - Developer documentation
    • twenty-ui/ - Component documentation
  2. Update navigation/base-structure.json if you need to change the tab/group hierarchy or add/remove pages. This file stays in the repo and is not uploaded to Crowdin.

  3. Keep the translation template (navigation/navigation.template.json) in sync by running yarn docs:generate-navigation-template after editing the base structure. This template is the only file that should be pushed to Crowdin.

  4. For each translated locale pulled from Crowdin, ensure a packages/twenty-docs/l/<language>/navigation.json file exists. These files contain labels only; page slugs always come from the base structure.

  5. Run yarn docs:generate to rebuild docs.json from the base structure + translated labels.

MDX Format

All documentation pages use MDX format with frontmatter:

---
title: Page Title
description: Page description
image: /images/path/to/image.png
---

Your content here...

Adding Images

  1. Place images in the /images/ directory
  2. Reference them in MDX: ![Alt text](/images/your-image.png)
  3. Or use Mintlify Frame component:
<Frame>
  <img src="/images/your-image.png" alt="Description" />
</Frame>

🔧 Configuration

  • navigation/base-structure.json - Source of truth for tabs, groups, icons, and page slugs (English only, not sent to Crowdin).
  • navigation/navigation.template.json - Generated translation template (labels only) that is uploaded to Crowdin.
  • l/<language>/navigation.json - Locale-specific label files pulled from Crowdin.
  • docs.json - Generated Mintlify configuration (always run yarn docs:generate after modifying navigation files).
  • package.json - Package dependencies and scripts (docs:generate, docs:generate-navigation-template, …).
  • project.json - Nx workspace configuration

📦 Validation

# Validate the documentation build
npx nx run twenty-docs:validate

🤝 Contributing

To contribute to the documentation:

  1. Fork the repository
  2. Make your changes in the packages/twenty-docs directory
  3. Test locally with npx nx run twenty-docs:dev
  4. Submit a pull request

📄 License

This documentation is part of the Twenty project and is licensed under AGPL-3.0.