From 0c721867785155cd61a98b9a014ea22cc1cf9a9a Mon Sep 17 00:00:00 2001 From: Yigit Colakoglu Date: Tue, 30 Dec 2025 17:53:50 -0800 Subject: [PATCH] Fix Poke webhook payload format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Poke API expects {"message": "..."}, not a complex structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/models/notification_models.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/models/notification_models.py b/src/models/notification_models.py index 1168feb..3c10632 100644 --- a/src/models/notification_models.py +++ b/src/models/notification_models.py @@ -38,23 +38,12 @@ class EmailNotificationPayload(BaseModel): def to_webhook_format(self) -> dict: """Convert to the format expected by Poke webhook.""" - return { - "type": self.event_type, - "timestamp": self.timestamp.isoformat(), - "data": { - "id": self.email_id, - "mailbox": self.mailbox, - "message_id": self.message_id, - "from": { - "email": self.from_email, - "name": self.from_name, - }, - "to": self.to_emails, - "subject": self.subject, - "snippet": self.snippet, - "date": self.date.isoformat(), - "has_attachments": self.has_attachments, - "is_flagged": self.is_flagged, - "in_reply_to": self.in_reply_to, - } - } + # Format sender + sender = self.from_name if self.from_name else self.from_email + + # Build message + message = f"New email from {sender}\nSubject: {self.subject}" + if self.snippet: + message += f"\n\n{self.snippet}" + + return {"message": message}