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(py): address python comments

jkomynoeb6564924e7c
diff --git a/python/composio/core/models/webhook_events.py b/python/composio/core/models/webhook_events.py
index 73e43f84e..790d5c2d7 100644
--- a/python/composio/core/models/webhook_events.py
+++ b/python/composio/core/models/webhook_events.py
@@ -17,6 +17,7 @@ class WebhookEventType(str, Enum):
"""Known webhook event types."""
CONNECTION_EXPIRED = "composio.connected_account.expired"
+ TRIGGER_MESSAGE = "composio.trigger.message"
class ConnectionStatusEnum(str, Enum):
@@ -102,6 +103,13 @@ class SingleConnectedAccountDetailedResponse(te.TypedDict, total=False):
Connected account data matching GET /api/v3/connected_accounts/{id} response.
This is used in webhook payloads for connection lifecycle events.
+ It intentionally does NOT reuse composio_client's ConnectedAccountRetrieveResponse
+ because webhook payloads arrive in raw snake_case format, while the SDK client
+ transforms responses to a different shape. This TypedDict validates the raw
+ webhook payload directly without any transformation layer.
+
+ See Also:
+ composio_client.types.connected_account_retrieve_response for the SDK version.
"""
toolkit: te.Required[ConnectedAccountToolkit]
@@ -155,7 +163,9 @@ class ConnectionExpiredEvent(te.TypedDict):
metadata: WebhookConnectionMetadata
-# Type alias for all webhook events
+# Type alias for non-trigger webhook events with specific typed schemas.
+# Trigger events (composio.trigger.message) are handled through the
+# TriggerEvent type in triggers.py via the trigger subscription system.
WebhookEvent = t.Union[ConnectionExpiredEvent]
diff --git a/python/tests/test_webhook_events.py b/python/tests/test_webhook_events.py
index d19dc1bc1..3b6eab33f 100644
--- a/python/tests/test_webhook_events.py
+++ b/python/tests/test_webhook_events.py
@@ -19,6 +19,10 @@ class TestWebhookEventType:
== "composio.connected_account.expired"
)
+ def test_trigger_message_value(self) -> None:
+ """Should have correct value for TRIGGER_MESSAGE."""
+ assert WebhookEventType.TRIGGER_MESSAGE.value == "composio.trigger.message"
+
class TestIsConnectionExpiredEvent:
"""Tests for is_connection_expired_event helper function."""