Threading

Every reply on the right thread

New sender, new subject, days later — it still lands on the conversation it answers. Your agent reads the whole thread in one call.

Four mails. No two look related.

YaRFQ 4471 — 3mm brushed sheetsnora@northwind.ioyou sent this
DRAutomatic reply: Out of officedana@lindmetall.deauto-reply
MLPrices for 3mm sheetmarco.lind@lindmetall.denew sender
DR3mm sheet — confirmeddana@lindmetall.defour days later

One conversation, in order.

thr_8f2c4 messages
YaRFQ 4471 — 3mm brushed sheetsMon 09:12
DRAutomatic reply: Out of officeMon 09:13
MLPrices for 3mm sheetsmart-matchedMon 11:48
DR3mm sheet — confirmedsmart-matchedFri 08:40

In the console

Everything that came back, on one page

RFQ 4471 — 3mm brushed sheets

4 messagesvia nora@northwind.iothr_8f2cUpdated 3 days ago

Mon, 14 Sep

YaYour agent — Hello, we are looking for 240 sheets of 3mm brushed…09:12
DRDana Ruiz — I am out of the office until Friday and will reply then.out of office09:13
MLMarco Lind marco.lind@lindmetall.deto youhuman11:48

Covering for Dana this week. We have 3mm brushed in stock.

Covers for Dana on the RFQ — "Covering for Dana this week"0.70

Fri, 18 Sep

DRDana Ruiz dana@lindmetall.deto you and marco.lind@lindmetall.dehuman08:40

Morning, I'm back — thanks Marco for covering.

$4.80 a sheet at 240 works. Delivery week 38, as agreed.

Confirms the price this thread asked for — "$4.80 a sheet at 240 works"0.70

In your code

One id in, the whole conversation out

1email.receivedwhat we post to your webhook
{  "type": "email.received",  "data": {    "thread_id": "thr_8f2c",    "from": "marco.lind@lindmetall.de"  }}
2GET /v1/threads/thr_8f2cwhat 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" } }  ]}
3your handlerin-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 })

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

Get started