Fix Poke webhook payload format
All checks were successful
Build And Test / publish (push) Successful in 47s

Poke API expects {"message": "..."}, not a complex structure.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-30 17:53:50 -08:00
parent 4299a6523a
commit 0c72186778

View File

@@ -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}