Fetching an Integration

Integrations enable users to connect their accounts with external applications, allowing agents to perform actions on their behalf. To view and manage all active integrations, visit the Dashboard.

Follow this guide to create your own integration

Once you create an integration, you can copy the Integration_ID from the dashboard.

from composio import Composio

client = Composio() 

Integration_ID = "Your Integration ID"

integration = client.get_integration(Integration_ID)

Connect an Account using Integration

Integrations are used to connect/authorise user’s accounts across tools, enabling agents to execute actions or triggers on those accounts.

Each integration will require some parameters and some actions from account owner to complete the authorisation process.

Tools like Linear support auth via OAuth & APIKey, but a particular integration created for Linear will always support choosen auth flow

Fetch the required params needed to complete the auth

integration = client.get_integration(Integration_ID)


Response from a Linear Integration

        "name": "api_key",
        "expected_from_customer": true,
        "displayName": "API Key",
        "description": "Your Linear API key for authentication. Obtain it from your Linear settings.",
        "type": "string",
        "required": true

In response above api_key parameter has to be collected from the user. Relevant field information that can be used to display a form in UI are also given.

Initiate Connection Request

Once you have gathered the necessary authentication parameters, use the initiate_connection method to initiate the connection.

params = {"api_key":"1231knakndasn"}

connection_request = integration.initiate_connection(params=params, entity_id = "user_id")

To avoid storing a mapping between users and connections in Composio, you may omit the entity_id by setting it to None. Alternatively, if you wish to maintain this association, provide your specific user identifier as the entity_id when calling initiate_connection.

In the response, you might get redirect_url for auth involving OAuth Flows and for them you can redirect the user to that URL to complete the authorisation.

Waiting for the user’s redirect flow to complete

connected_account = connected_account.wait_until_active(timeout=60)

Checking the status of the connected_account

connected_account = composio.get_connected_account(connection_request.id)
  • Status Active means that connection was successful
  • Status Initiated means that connection process is still underway, occurs when user closes the redirect flow before authorising.

Executing an Action

To manually execute an action, use the connected_account.execute_action method.

action_inputs = {}
action_name = ""


Fetching Supported Actions using ConnectedAccount

actions = connected_account.get_all_actions()

# In case specific schema is needed for input fields of actions array 
# For example openai compatible actions 

# from composio import SchemaFormat
# get_all_actions(SchemaFormat.OPENAI)

# You can also use tags to filter actions
# get_all_actions(tags=[Tag.ASANA_TASKS])  

Was this page helpful?