Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: initiate connection payload formation

angrybayblade0f93cc656de7
diff --git a/python/composio/core/models/connected_accounts.py b/python/composio/core/models/connected_accounts.py
index 2050f5a49..bc2245066 100644
--- a/python/composio/core/models/connected_accounts.py
+++ b/python/composio/core/models/connected_accounts.py
@@ -340,16 +340,16 @@ class ConnectedAccounts:
:param options: The options to create the connected account with.
:return: The connection request.
"""
+ connection: dict[str, t.Any] = {"user_id": user_id}
+ if callback_url is not None:
+ connection["callback_url"] = connection
+
+ if config is not None:
+ connection["state"] = connection
+
response = self._client.connected_accounts.create(
auth_config={"id": auth_config_id},
- connection=t.cast(
- connected_account_create_params.Connection,
- {
- "user_id": user_id,
- "state": config,
- "callback_url": callback_url,
- },
- ),
+ connection=t.cast(connected_account_create_params.Connection, connection),
)
return ConnectionRequest(
id=response.id,