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}