Introduction to Connected Accounts

  • When a user connects their account, a connected_account object is created.
  • Connected Account securely stores authentication data such as api keys, access tokens and refresh tokens.

Introduction to Entities

  • Each unique user/tenant is represented by a unique entity id.
  • If you have two users, Jessica and Melissa, they will each have unique entity ids.

Connecting an Account for your User

1

Collect Parameters Required to create a Connection

To create a connected account for your user:

  1. Fetch required auth parameters for the application
  2. Collect these parameters from the user
  3. Initiate a new connection request
Linear: Requires api_key, Shopify: Requires shop_name for OAuth flow

Collect the required parameters from your user through your preferred interface (UI, chat, or API).

All parameters should be provided as strings.

2

Try creating a connection with the parameters collected

In the code snippets below replace user_id and redirect_url

Some applications require user redirection to complete the authentication process. Gmail for example requires redirecting the user to Google’s login page.

3

Fetch the Connection Params (Status, Access Token, Refresh Token...)

If you want to use connection params locally and build custom actions -

Connection status can be failed, initiated or active.

Example of how connection params would look like

You can fetch connection details after user is redirected back to your app. (If redirect was needed)

connection_status & connectedAccountId will be available in the query params.

Receiving Webhooks alerts on new Connections

Composio provides real-time webhook notifications for new connections. To utilize this feature:

  1. Set up webhook alerts in the Composio dashboard
  2. Configure your application to receive and parse the webhook payloads

This allows you to instantly track when users integrate new services with your application.