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.

docs: fix trigger event payload nesting in gmail labeler

Sushmitha Mallesh2e1187c93b83
diff --git a/docs/examples/gmail-labeler/main.py b/docs/examples/gmail-labeler/main.py
index 6dd976809..3be5b0608 100644
--- a/docs/examples/gmail-labeler/main.py
+++ b/docs/examples/gmail-labeler/main.py
@@ -76,14 +76,15 @@ def listen(user_id: str):
@subscription.handle(trigger_id=trigger.trigger_id)
def handle_event(data):
- print(f"New email: {data.get('subject', 'No subject')}")
+ payload = data.get("payload", {})
+ print(f"New email: {payload.get('subject', 'No subject')}")
try:
loop.run_until_complete(
label_email(
session,
- message_id=data.get("id", ""),
- subject=data.get("subject", ""),
- body=data.get("message_text", ""),
+ message_id=payload.get("id", ""),
+ subject=payload.get("subject", ""),
+ body=payload.get("message_text", ""),
)
)
except Exception as e: