# Every reply on the right thread

New sender, new subject, days later — it still lands on the conversation it answers. Your agent reads it in one call, up to 100 messages at a time.

[Get started](/signup)
[Documentation](https://docs.aiinbx.com/guides/threads)

Four mails that look unrelated: the RFQ you sent, Dana's out-of-office auto-reply, a reply from Marco (a new sender with a new subject), and Dana's confirmation four days later. They fold into one conversation, thread thr\_8f2c, in order, with the last two smart-matched.

In the console

## Everything that came back, on one page

The console's thread page shows all four messages of the thread in order, each labelled with its category (out of office, human). Under each smart-matched message it says why it belongs to this thread, such as Marco covering for Dana and Dana confirming the price.

In your code

## One id in, the whole conversation out

Step 1, email.received: what we post to your webhook.

```
{
  "type": "email.received",
  "data": {
    "thread_id": "thr_8f2c",
    "from": "marco.lind@lindmetall.de"
  }
}
```

Step 2, GET /v2/threads/thr\_8f2c: what one call gives you back.

```
{
  "id": "thr_8f2c",
  "subject": "RFQ 4471 — 3mm brushed sheets",
  "messages": [
    { "direction": "outbound", "from": { "address": "nora@northwind.io" } },
    { "direction": "inbound",  "from": { "address": "dana@lindmetall.de" } },
    { "direction": "inbound",  "from": { "address": "marco.lind@lindmetall.de" } },
    { "direction": "inbound",  "from": { "address": "dana@lindmetall.de" } }
  ]
}
```

Step 3, your handler: in-reply-to, references and subject: ours.

```
const { thread_id } = event.data

const thread = await aiinbx.threads.retrieve(thread_id)
const answer = await agent.run(thread.messages)

await aiinbx.threads.reply(thread_id, { text: answer })
```

Solutions

## Where it comes in

-   [Inbound email APIReceive email in your app over an API. Point an MX record at AI Inbx or connect Gmail and Outlook, and every message arrives as a signed, parsed JSON webhook.ThreadingAttachmentsMailboxesWildcard domains](/solutions/inbound-email-api)
-   [Email reply parserParse every email reply down to what the sender wrote: quoted text and repeated signatures removed, answers typed inside the quote kept where they were.ThreadingMailboxes](/solutions/email-reply-parser)
-   [Send email APISend email from your domain or your users' own Gmail and Outlook with one API call. Opt-outs and pacing are checked first, and replies land on the thread.ThreadingMailboxesPacingSuppressions](/solutions/send-email-api)
-   [Scheduled email APISchedule an email up to 30 days ahead, then move or cancel it by id until its time comes. It is composed then, so suppressions and threads stay current.ThreadingSending hoursSuppressions](/solutions/scheduled-email-api)
-   [Email open trackingTrack email opens and clicks per domain or per send. Apple privacy prefetches and security scanner clicks arrive flagged as bots, each with its reason.Threading](/solutions/email-open-tracking)

## Give your product an inbox. The hard parts are already handled.

[Get started](/signup)
