Blueping

Every order email gets its answer.

The agent finds the order in each email, answers with its status from your shop's system, and attaches the return label when one is due.

Your code reply + label
// Order 48214 qualifies: answer with the labelPOST /v1/messages/em_5Hj3Lr8T/reply{ "text": "Your return is open, Ben.", "attachments": [{ "filename": "return-label-48214.pdf", "content_type": "application/pdf", "content_base64": "JVBERi0x" }] }202 { "status": "sent" }

larkspur-orders@blueping.dev

Larkspur Outdoor, orders and returns

Ben Ito8:47 AM
to larkspur-orders@blueping.dev
Return for order 48214

The jacket is too small. How do I send it back?

Larkspur Orders8:48 AM
to Ben Ito

Your return is open, Ben. The label is attached: print it and drop the parcel at any Parcelwise point.

Larkspur Orders · larkspur-orders@blueping.dev

Your webhook email.received
{  "type": "email.received",  "data": {    "inbox": { "address": "larkspur-orders@blueping.dev" },    "message": {      "id": "em_5Hj3Lr8T",      "from": { "name": "Ben Ito" },      "subject": "Return for order 48214",      "extracted_text": "The jacket is too small. How do I send it back?"    }  }}

Ben's question reaches larkspur-orders@blueping.dev, the agent looks the order up in your shop, and its reply carries the return label in the same thread.

How can an AI agent handle order, shipping and return emails?

Give the agent an orders inbox, let it find the order number in each email and look it up in your shop's system, then answer with POST /v1/messages/{id}/reply, attaching the return label when a return is open. Carrier notices go to the same inbox and become labels on the order, so the agent answers from the latest status.

The questions every online shop answers by hand

Larkspur Outdoor sells hiking gear from its own storefront and ships about 4,000 orders a month. Roughly one order in ten produces an email: where is my parcel, can I change the size, how do I return this jacket. Carriers send their own notices on top, delivered, delayed, returned to sender. Two people spend their mornings copying order numbers between the mailbox and the shop's admin.

Each email needs the order number, the order's status from the shop's own system, and one of a few answers: the tracking number, the return instructions with a label, or a hand-off to a person when something arrived damaged. The time goes into the copying, and the risk into the odd email that asks for a refund to a different card.

Now larkspur-orders@blueping.dev does the copying. It reads the order number, asks the shop's API, answers in the customer's thread, attaches the return label the carrier made, and labels every message with its order, so anyone on the team can list order:48213 and see the whole story.

From a customer's question to the answer, order by order

The agent works from your shop's data; Blueping supplies the inbox, the threads, the files and the labels.

  1. Create the orders inbox

    One inbox with a display_name customers recognize. Put its address in your order confirmations' Reply-To, so customers who answer a confirmation write to the agent.

    Call: POST /v1/inboxes with client_id and display_name

    Answer: 201 with id and address

    Checked: The plan's inboxes; customers can write to it the moment it exists

  2. Find the order in the email

    The agent reads the subject and extracted_text and looks for an order number. Searching the inbox for that number with q brings up every earlier email about the same order.

    Call: GET /v1/inboxes/{id}/messages?q=48213

    Answer: Every message that mentions the number in its subject, sender or text, newest first

    Checked: Search reads the first 10 words of q, and every word must match

  3. Answer with the order's status

    The agent asks your shop's API for the order and replies in the thread with the status and the tracking number, or asks for the order number when the email has none.

    Call: POST /v1/messages/{id}/reply with text

    Answer: 202 with the reply's id, in the customer's thread

    Checked: Outbound text is checked: a link shortener or a request for card details next to a link is refused with 422 content_refused

  4. Send the return label

    For an eligible return, the agent attaches the label PDF your carrier's API generated to the same reply. The customer gets the instructions and the label in one email.

    Call: POST /v1/messages/{id}/reply with attachments

    Answer: 202, with the file in the sent message's attachments

    Checked: A return label fits easily: 10 MB of files per message

  5. File carrier notices

    Carriers that email tracking events write to the same inbox. The agent turns each one into labels such as order:48213 and carrier:delivered, and your shop's system takes the update.

    Call: PATCH /v1/messages/{id} with add_labels

    Answer: The message's labels

    Checked: Only proven carrier senders are trusted: auth.verdict is pass

Step 2's search for an order number, each message cut to the fields the desk reads:

{
  "data": [
    {
      "id": "em_3Hk9Tc2Vb8Lw1Qx5",
      "direction": "in",
      "from": { "address": "ana@shopper.example", "name": "Ana Ruiz" },
      "subject": "Where is my order #48213?",
      "extracted_text": "Hello, my order 48213 hasn't arrived yet.",
      "labels": ["handled", "order:48213"],
      "auth": { "spf": "pass", "dkim": "pass", "dmarc": "pass", "verdict": "pass" }
    }
  ],
  "order": "newest_first",
  "next_cursor": null,
  "next_since": "em_3Hk9Tc2Vb8Lw1Qx5",
  "held": { "count": 0, "reasons": { "suspicious": 0, "unauthenticated": 0 }, "show_with": "include=held" }
}

The orders desk in Python and Node.js

The program answers every new email once and labels it handled. ORDERS and return_label() stand for your shop's order API and your carrier's label API. Everything else is the Blueping API as published.

# orders_desk.py: answer order, shipping and return emails from your shop's own data. Run it every minute.
# pip install requests
import base64
import os
import re

import requests

API = "https://blueping.dev/v1"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['BLUEPING_API_KEY']}"

ORDERS = {  # your shop's order API stands in here
    "48213": {"status": "shipped", "carrier": "Parcelwise", "tracking": "PW44021187", "delivered_days_ago": None},
    "48214": {"status": "delivered", "carrier": "Parcelwise", "tracking": "PW44021188", "delivered_days_ago": 6},
}


def return_label(number):
    # Your carrier's label API returns the PDF; these bytes stand in for it.
    return f"%PDF-1.4\n% return label for order {number}\n".encode()


def reply(message, text, files=()):
    attachments = [
        {"filename": name, "content_type": "application/pdf", "content_base64": base64.b64encode(data).decode()}
        for name, data in files
    ]
    return session.post(
        f"{API}/messages/{message['id']}/reply",
        json={"text": text, "attachments": attachments},
        headers={"Idempotency-Key": f"order-reply-{message['id']}"},
    ).json()


inbox = session.post(f"{API}/inboxes", json={"client_id": "orders", "display_name": "Larkspur Orders"}).json()
page = session.get(f"{API}/inboxes/{inbox['id']}/messages", params={"limit": 50}).json()
for message in reversed(page["data"]):
    if message["direction"] != "in" or "handled" in message["labels"]:
        continue
    words = f"{message['subject']} {message['extracted_text']}"
    found = re.search(r"\b(\d{5})\b", words)
    number = found.group(1) if found else None
    order = ORDERS.get(number)
    if order is None:
        reply(message, "Thanks for writing. Which order is this about? Its five-digit number is in your confirmation email.")
        labels = ["handled", "order:unknown"]
    elif "return" in words.lower() and order["delivered_days_ago"] is not None and order["delivered_days_ago"] <= 30:
        text = f"Your return for order {number} is open. Print the attached label and drop the parcel at any {order['carrier']} point."
        reply(message, text, [(f"return-label-{number}.pdf", return_label(number))])
        labels = ["handled", f"order:{number}", "return"]
    else:
        reply(message, f"Order {number} is {order['status']}. {order['carrier']} tracking number: {order['tracking']}.")
        labels = ["handled", f"order:{number}"]
    session.patch(f"{API}/messages/{message['id']}", json={"add_labels": labels})
    print(" ".join(labels[1:]), message["id"])

The 30-day window, the carrier and the wording are your shop's policy: keep them in your own code or prompt, and let the model write the sentences. The label order:48213 is what a later lookup filters on: labels=order:48213 returns the order's whole story in one call.

The same desk from an MCP client

Connected to the MCP server next to your shop's own tools, a model can run the desk in a conversation: Blueping's tools handle the mail, your tools handle the orders.

In larkspur-orders, answer each new customer email: find the order number, look the order up with the orders tool, and reply in the thread with its status and tracking number. For returns within 30 days of delivery, tell me which ones qualify so I can send the labels. Label each thread order: followed by the number.
ToolWhat it does here
list_messagesReads what is new in the orders inbox.
search_messagesFinds every email about one order by its number.
reply_to_emailAnswers the customer in the thread.
label_threadPuts order:48213 on every message of the conversation.
forward_emailPasses a damaged-item email, with its photos, to the person who decides.

Files go through the API: reply_to_email sends text and HTML, and the return label PDF goes with attachments on POST /v1/messages/{id}/reply, as the program above does.

File carrier notices the moment they land

Carrier notices are machine mail, and your shop wants them in its database within seconds. Subscribe to email.received, check the signature as Webhooks shows, and pass each event to the handler below. It trusts only the carriers you list, and only when DMARC proves them.

// carrier-hook.mjs: the part of your webhook server that files carrier notices against your orders.
// Check the Blueping-Signature header before calling handle(): /docs/webhooks#verify has the code.
const API = "https://blueping.dev/v1";
const headers = { Authorization: `Bearer ${process.env.BLUEPING_API_KEY}`, "Content-Type": "application/json" };
const CARRIERS = ["parcelwise.example"]; // the carriers that email your orders' tracking events

export async function handle(event) {
  if (event.type !== "email.received") return;
  const { message } = event.data;
  if (!CARRIERS.includes(message.from.address.split("@")[1]) || message.auth.verdict !== "pass") return;
  const order = message.subject.match(/order (\d{5})/i)?.[1];
  if (!order) return;
  const state = /delivered/i.test(message.subject) ? "delivered" : /delay/i.test(message.subject) ? "delayed" : "in-transit";
  // Your shop's API records the new state here; a delay can trigger a note to the customer.
  await fetch(`${API}/messages/${message.id}`, { method: "PATCH", headers, body: JSON.stringify({ add_labels: [`order:${order}`, `carrier:${state}`] }) });
  console.log(`order ${order} ${state}`);
}

Labels set here show on the order's thread right away, so the next customer email about order 48213 finds carrier:delivered and gets the right answer.

What stops fraud on the order desk

Shops get a particular kind of fraud by email. The inbox handles the parts that are about mail, and your policies handle the money.

Refunds to someone else's card

An email that asks for a refund to a new card or a new address is a policy question. The agent answers from your shop's rules, and your rules send any change of payee to a person.

A forged customer or carrier

A message forged in a customer's or a carrier's name fails that domain's DMARC policy: it is turned away or held as unauthenticated, and never reaches the desk's list. The carrier handler above also acts only on the carriers it lists, with auth.verdict: pass, so a fake notice can't mark an order delivered.

Photos of damage

Customers attach photos. They download by id, as they arrived; images aren't read as text, so a vision model of yours looks at them, and a person decides on the claim.

Outbound text that reads like phishing

A reply that asks people to confirm card details next to a link, or that uses a link shortener, is refused with 422 content_refused before it leaves. Write the full address of the tracking page instead.

What 4,000 orders a month need

At one email in ten, 4,000 orders bring about 400 customer emails and a thousand carrier notices a month. The agent replies to the customers, roughly 500 sends with follow-ups. Customers' photos bring 90 days of mail near 2 GB.

Developer fits this setup: 50 inboxes, 15,000 sends a month and 1,500 a day, and 15 GB of storage, for $19 a month, or $180 a year. Its mail goes to people outside your company without a footer. Free runs the same flow at no cost, with a one-line footer on each email, which suits a trial.

Receiving is never counted, and each recipient of a send counts once. Every limit is on Limits, and every price on Pricing.

The API referenceWebhooksThe MCP serverBlueping vs InkboxAll use cases

Last checked against the API on .

Questions about order emails

What builders ask before they set it up. The docs answer the rest.

Read the docs

Can the agent read the photo a customer sent?

It downloads it by id with GET /v1/messages/{id}/attachments/{attachment_id} and hands it to a model that reads images. Text files, PDFs, Word and Excel files also come back as text through the attachment's /text route.

How does it find the order?

From the subject and the text, then q searches the inbox for that number across subjects, senders and text, so earlier emails about the same order come up too.

Can it send a return label?

Yes. A reply takes attachments, each with a filename, a content_type and content_base64, up to 10 MB per message.

What about order confirmations to every buyer?

Those belong to your store platform's own mailer: each buyer is a new recipient, and Blueping paces new recipients at 20 an hour on Free, 100 on Developer, 500 on Startup and 2,000 on Scale. Put the agent's address in the confirmation's Reply-To, and every customer who answers reaches the agent.

What if a customer replies to an old thread?

The reply threads by its headers, so it lands in the same conversation with the earlier answers, and the order label is already there.

Can the agent write first to a customer about a delay?

Yes, within the plan. A customer the agent already answered never counts toward the ramp again; one it never wrote to counts once as a new recipient.

Give your orders an inbox

Order numbers, return labels and carrier notices, in one place.