Fix Poke webhook payload format
All checks were successful
Build And Test / publish (push) Successful in 47s
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:
@@ -38,23 +38,12 @@ class EmailNotificationPayload(BaseModel):
|
|||||||
|
|
||||||
def to_webhook_format(self) -> dict:
|
def to_webhook_format(self) -> dict:
|
||||||
"""Convert to the format expected by Poke webhook."""
|
"""Convert to the format expected by Poke webhook."""
|
||||||
return {
|
# Format sender
|
||||||
"type": self.event_type,
|
sender = self.from_name if self.from_name else self.from_email
|
||||||
"timestamp": self.timestamp.isoformat(),
|
|
||||||
"data": {
|
# Build message
|
||||||
"id": self.email_id,
|
message = f"New email from {sender}\nSubject: {self.subject}"
|
||||||
"mailbox": self.mailbox,
|
if self.snippet:
|
||||||
"message_id": self.message_id,
|
message += f"\n\n{self.snippet}"
|
||||||
"from": {
|
|
||||||
"email": self.from_email,
|
return {"message": message}
|
||||||
"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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user