drin-agent-inbox
Run an autonomous email inbox with Drin — receive inbound email on a domain, read conversation threads, and reply in-thread. Use when building or operating an agent that must read …
IRONBEEM
@atom00blue
Install
$ openclaw skills install @atom00blue/drin-agent-inboxOperating an agent email inbox with Drin
Drin is bidirectional: besides sending, a domain can receive email, which Drin parses into conversation threads your agent can read and reply to. This is the foundation for an agent you can email.
1. Enable receiving on a domain
- Turn it on:
set_domain_receivingwithenabled: true(orPATCH /v1/domains/:id/receiving). Drin returns the MX record(s) to publish. - Publish the MX record(s) in DNS. Until they propagate, no inbound arrives.
- Verify with
get_domain_receiving/GET /v1/domains/:id/receiving.
The domain must already be verified for sending (see drin-email-best-practices)
so the agent can also reply.
2. Create an inbox (a receive address)
create_inboxwith{ address: "support@acme.com", domainId: "<id>" }(orPOST /v1/inboxes). This is the address people email to reach the agent.- List existing ones with
list_inboxes.
3. Read inbound — threads, not raw mailboxes
Inbound and outbound messages are joined into threads.
list_threads(optionallyinboxId) — most-recent-first feed. Each thread has alastMessageAtand subject.get_threadwith the thread id — the full conversation, oldest→newest, both directions, including each message'sdirection,from,to,subject, and status.- For a single message's full content:
get_email(detail/lifecycle),get_email_body(the archived{ html, text }), andlist_email_attachments(download bytes via the authenticatedurl).
Two ways to know when new mail arrives:
- Poll: periodically
list_threadsand diff against the last id/timestamp you processed. - Webhook (preferred for real-time): register a webhook for the inbound
events with
create_webhook(drin webhooks create --url <url> --event inbound_received/POST /v1/webhooks); Drin POSTs a signed payload when mail is received, and returns asigningSecretONCE on creation. Verify the signature (drin.webhooks.verifyin the SDK) before trusting it.
4. Decide, then reply in-thread
For each new inbound message:
- Read the body (
get_email_body) and any attachments. - Decide what to do (answer, take an action with other tools, escalate).
- Reply on the thread so the recipient's client keeps the conversation
together:
reply_emailwith{ messageId: "<inbound id>", text: "...", html: "..." }(orPOST /v1/emails/:id/reply). Drin setsIn-Reply-To/Referencesand theRe:subject automatically;fromdefaults to the inbox address andtoto the original sender.
Keep a record of which message ids you've already handled so you never reply
twice (idempotency). When replying to action requests, pass an idempotencyKey.
5. Test without real email
Use the simulator to exercise the whole receive → thread → (webhook) path safely:
simulate_inboundwith{ to: "support@acme.com", from: "Customer <c@example.com>", subject: "Help", text: "..." }(orPOST /v1/inbound/simulate). The synthesized message is flaggedtest_mode(excluded from metrics/billing) but flows through ingest, threads, and any webhooks exactly like a real one — so you can build and verify the agent loop before pointing real DNS at it.
Minimal agent loop (pseudocode)
seen = load_processed_ids()
for thread in list_threads(inboxId):
convo = get_thread(thread.id)
for msg in convo.messages where msg.direction == "inbound" and msg.id not in seen:
body = get_email_body(msg.id)
action = decide(convo, body) # your agent's reasoning
reply_email(messageId=msg.id, text=action.reply, idempotencyKey=msg.id)
seen.add(msg.id)
save_processed_ids(seen)
Always honor suppressions and never reply to mail you can't authenticate as genuinely inbound (verify webhook signatures).
Top skills in this category
Humanizer
@biostartechnologyRemove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.
Slack
@steipeteUse when you need to control Slack from Clawdbot via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
PollyReach
@pollyreachPollyReach gives every AI agent a phone number and the ability to get things done over the phone — finding contacts, making calls, and completing tasks. Just...
imap-smtp-email
@gzlicanyiRead and send email via IMAP/SMTP. Check for new/unread messages, fetch content, search mailboxes, mark as read/unread, and send emails with attachments. Supports multiple accounts. Works with any IMAP/SMTP server including Gmail, Outlook, 163.com, vip.163.com, 126.com, vip.126.com, 188.com, and vip
Answer Overflow
@rhyssullivanSearch indexed Discord community discussions via Answer Overflow. Find solutions to coding problems, library issues, and community Q&A that only exist in Discord conversations.