Fetch the full message referenced by an ``email.received`` event. The event is a metadata-only notification; this resolves its ``(recipient, message_id)`` fetch keys and returns the full :class:`MessageView` (body, attachments, signed headers). Raises ``ValueError``
(self, event: WebhookEvent)
| 528 | self._c = client |
| 529 | |
| 530 | async def fetch_message(self, event: WebhookEvent) -> MessageView: |
| 531 | """Fetch the full message referenced by an ``email.received`` event. |
| 532 | |
| 533 | The event is a metadata-only notification; this resolves its |
| 534 | ``(recipient, message_id)`` fetch keys and returns the full |
| 535 | :class:`MessageView` (body, attachments, signed headers). Raises |
| 536 | ``ValueError`` if the event is not an ``email.received`` carrying those |
| 537 | keys. |
| 538 | """ |
| 539 | data = event.data if isinstance(event.data, dict) else {} |
| 540 | message_id = data.get("message_id") |
| 541 | recipient = data.get("recipient") |
| 542 | if event.type != "email.received" or not message_id or not recipient: |
| 543 | raise ValueError( |
| 544 | "fetch_message expects an email.received event with message_id and recipient" |
| 545 | ) |
| 546 | return await self._c.messages.get(recipient, message_id) |
| 547 | |
| 548 | def list(self) -> AutoPager[WebhookView]: |
| 549 | async def fetch(_cursor: Optional[str]) -> Page: |