Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Add composio link docs (#1913)
Musthaq Ahamadab42809b4f7c
diff --git a/ts/docs/api/connected-accounts.md b/ts/docs/api/connected-accounts.mdindex 209cb5608..2d2970cad 100644--- a/ts/docs/api/connected-accounts.md+++ b/ts/docs/api/connected-accounts.md@@ -31,9 +31,49 @@ const githubAccounts = await composio.connectedAccounts.list({**Throws:** ValidationError if the query fails validation against the expected schema++### link(userId, authConfigId, options?)++Creates a Composio Connect Link for a user to connect their account to a given auth config. This method returns an external link which you can use for the user to connect their account through Composio's hosted authentication flow.++```typescript+// Create a connection request and redirect the user to the redirect URL+const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123');+const redirectUrl = connectionRequest.redirectUrl;+console.log(`Visit: ${redirectUrl} to authenticate your account`);++// Wait for the connection to be established+const connectedAccount = await connectionRequest.waitForConnection();+```++```typescript+// Create a connection request with callback URL+const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123', {+ callbackUrl: 'https://your-app.com/callback'+});+const redirectUrl = connectionRequest.redirectUrl;+console.log(`Visit: ${redirectUrl} to authenticate your account`);++// Wait for the connection to be established+const connectedAccount = await composio.connectedAccounts.waitForConnection(connectionRequest.id);+```++**Parameters:**++- `userId` (string): The external user ID to create the connected account for+- `authConfigId` (string): The auth config ID to create the connected account for+- `options` (CreateConnectedAccountLinkOptions): Optional configuration for the link+ - `callbackUrl` (string): The URL to redirect the user to after connecting their account++**Returns:** Promise<ConnectionRequest> - Connection request object with redirect URL++**Throws:**+- `ValidationError`: If the options fail validation+- `ComposioFailedToCreateConnectedAccountLink`: If the link creation fails+### initiate(userId, authConfigId, options?)-Creates a new connected account and returns a connection request. Users can then wait for the connection to be established using the `waitForConnection` method.+Creates a new connected account by accepting the parameters manually and returns a connection request. Users can then wait for the connection to be established using the `waitForConnection` method.```typescript// For OAuth based auth configs (no additional parameters needed)@@ -84,6 +124,7 @@ const connectedAccount = await oauthConnection.waitForConnection();**Returns:** Promise<ConnectionRequest> - Connection request object+### waitForConnection(connectedAccountId, timeout?)Waits for a connection request to complete and become active.@@ -275,6 +316,14 @@ interface CreateConnectedAccountOptions {}```+### CreateConnectedAccountLinkOptions++```typescript+interface CreateConnectedAccountLinkOptions {+ callbackUrl?: string; // URL to redirect the user to after connecting their account+}+```+### ConnectedAccountUpdateStatusParams```typescript