@devries-cameron20 / composio-1 / commits / 2e1187c93
Fork 0

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

docs: fix trigger event payload nesting in gmail labeler

Access email fields from data["payload"] instead of data directly. The SDK subscription callback receives a TriggerEvent where email data (subject, id, message_text) is nested under the payload key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Feb 25, 2026 at 18:53 UTC 2e1187c93b8318da6b352a3dda8c2c5d4bad5637
1 file changed +5 -4
docs/examples/gmail-labeler/main.py
+5 -4
@@ -76,14 +76,15 @@ def listen(user_id: str):
76
77 @subscription.handle(trigger_id=trigger.trigger_id)
78 def handle_event(data):
79 - print(f"New email: {data.get('subject', 'No subject')}")
79 + payload = data.get("payload", {})
80 + print(f"New email: {payload.get('subject', 'No subject')}")
81 try:
82 loop.run_until_complete(
83 label_email(
84 session,
84 - message_id=data.get("id", ""),
85 - subject=data.get("subject", ""),
86 - body=data.get("message_text", ""),
85 + message_id=payload.get("id", ""),
86 + subject=payload.get("subject", ""),
87 + body=payload.get("message_text", ""),
88 )
89 )
90 except Exception as e: