# Inbox

Your campaigns' email conversations, as your team sees them in DialEcho's inbox: read threads and their messages, poll for new inbound replies, answer them from the campaign mailbox or the reply address, and mark threads read or archived. Contact campaign inboxes (`contact`) and real-estate offer campaign inboxes (`realestate`) are both served; every conversation and message names its `domain`.

Reads need `inbox:read`; replies and read or archive changes need `inbox:reply`, which does not include reading. The key's member must be able to use the campaign's inbox in DialEcho (its message and email permissions) and see the contact: other conversations are left out of lists and reported as `404`. Addresses follow the member's email visibility (hidden ones are `null` or left out, masked ones look like `p***@example.com`), and when the role masks messages, `text` is `Restricted`, `html` is `null` and `attachments` is empty.

To act on replies as they arrive, poll the inbound message feed and answer with a reply. The feed delivers each message at least once, so deduplicate by message `id`.

## Endpoints

### [List conversations](/api/inbox/list-conversations)

`GET /v1/inbox/conversations`

Returns the conversations that changed in a time window, oldest change first.

### [Retrieve a conversation](/api/inbox/get-conversation)

`GET /v1/inbox/conversations/{conversation_id}`

Returns a conversation with its messages, oldest first.

### [List inbound messages](/api/inbox/list-inbound)

`GET /v1/inbox/inbound-messages`

A polling feed of new inbound emails, each with its conversation's state.

### [Reply to a conversation](/api/inbox/reply)

`POST /v1/inbox/conversations/{conversation_id}/replies`

Emails a reply to the conversation's latest inbound message, from the campaign mailbox or the reply address.

### [Update a conversation](/api/inbox/update-conversation)

`PATCH /v1/inbox/conversations/{conversation_id}`

Marks a conversation read or unread, or archives or restores it.
