Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
docs: show connection links as cards (DEVREL-201) (#5375)
## Summary Developers building chat interfaces could find instructions for forwarding Composio authentication links, but no example of displaying those links as connection cards. This adds a React example for `COMPOSIO_MANAGE_CONNECTIONS` results to the authentication guide. Addresses [DEVREL-201: Provide an example of custom connector link UI](https://linear.app/composio/issue/DEVREL-201/provide-an-example-of-custom-connector-link-ui). Designated PR reviewer: @jkomyno. ## Changes - Add `ConnectionCards`, a React component that validates decoded tool results with Zod and renders a card for each toolkit's `initiated`, `active`, or `failed` connection state. - Include a sample result, explain how to route tool output to the component, and require a fresh connection-status check before resuming app tools. - Link to callback configuration and white-label authentication for other connection flows. The card opens the existing hosted authentication URL. ## Type of change - [ ] Bug fix - [ ] New feature - [ ] Refactor/Chore - [x] Documentation - [ ] Breaking change ## How Has This Been Tested? At head `48c3d7288f69d2a3b50e99effe6c8355e9544f2d`: - Re-ran `cd docs && bun run check:code-examples` before opening this PR, using existing shared dependencies without installing packages. Exit 0: ```text No code example violations in 449 file(s). ``` - `git diff --check origin/next...HEAD` passed. `git merge-tree --write-tree origin/next HEAD` completed without conflicts. - During implementation at this same head, extracted the documented TSX component and type-checked it with strict TypeScript settings. Rendered it with React's `renderToStaticMarkup` to check pending, connected, failed, missing-link, unsuccessful, malformed, multiple-toolkit, unsafe-URL, and escaped-error cases. The sample JSON also passed validation against the committed meta-tool response schema, and the MDX compiled. These were temporary checks, not committed test files. - Full link checking was attempted during implementation but could not run because the worktree lacked the generated `fumadocs-mdx:collections/server` module. Added link targets were checked directly against their source pages. - No dependency installation or `next build` was run. No live authentication flow was tested. ## Screenshots (if applicable) No browser screenshots were captured. This adds a documented component rather than changing the docs site's UI. The example accepts the decoded tool result in an existing React chat renderer: ```tsx <ConnectionCards result={toolResult} /> ``` | Input state | Rendered output | | --- | --- | | `initiated` with an HTTPS `redirect_url` | Connect button opening the returned URL in a new tab | | `active` | Connected status | | `failed` | Error message | | Malformed or unsuccessful result | Validation error message | ## Checklist - [ ] I have read the Code of Conduct and this PR adheres to it - [ ] I have read and understand every line of this diff, including any LLM-generated code - [x] Any third-party docs links or promotional content follow the third-party links policy; this change adds internal docs links only - [ ] I ran linters/tests locally and they passed; the passing checks and link-check limitation are listed above - [x] I updated documentation as needed - [x] I added tests or explain why not applicable; this is a docs-only example, checked with the temporary rendering and schema checks above - [ ] I added a changeset if this change affects published packages; not applicable to this docs-only change ## Additional context The agent wrote and checked the example. Brendan requested the work and authorized opening this PR; human review of the full diff remains outstanding. In plain words: the example turns an account connection link into a card in your chat. Opening the link starts authentication, and the card shows success only after Composio confirms the connection.