Blueping

Quotes compared. You approve.

The agent emails each approved supplier, compares the quotes as they come back, and drafts the purchase order for a person to send.

Your code read, then draft
// Read the quote, then draft the orderGET /v1/messages/em_2Lp8Vd4K/attachments/att_4Qm1/text200 { "text": "| M3x10 brass standoff | 0.19 | 12 |" }POST /v1/inboxes/inb_6Hd2/drafts{ "reply_to_message_id": "em_2Lp8Vd4K", "text": "Purchase order PO-118 …" }201 { "status": "draft" }

halden-purchasing@blueping.dev

Halden Robotics, purchasing

Kessler Fasteners3:40 PM
to halden-purchasing@blueping.dev
Re: Request for quote RFQ-118

Our quote is attached: 0.19 a standoff, delivered in 12 days.

quote.csv
Halden PurchasingDraft
to Kessler Fasteners

Purchase order PO-118: 500 M3x10 brass standoffs at 0.19, delivered in 12 days.

Halden Purchasing · halden-purchasing@blueping.dev

Your webhook email.received
{  "type": "email.received",  "data": {    "inbox": { "address": "halden-purchasing@blueping.dev" },    "message": {      "id": "em_2Lp8Vd4K",      "from": { "address": "sales@kessler-fasteners.example" },      "subject": "Re: Request for quote RFQ-118",      "attachments": [ { "id": "att_4Qm1", "filename": "quote.csv" } ]    }  }}

The third quote reaches halden-purchasing@blueping.dev, the agent reads the attached file as text, and the purchase order waits as a draft until a person sends it.

How can an AI agent request quotes and handle purchase orders by email?

Lock the agent's inbox to your approved suppliers with send allow rules, email each one the request for quote in its own thread, and read the quotes that come back with GET /v1/messages/{id}/attachments/{attachment_id}/text. The agent then writes the purchase order as a draft with POST /v1/inboxes/{id}/drafts, and a person sends it with one call once they approve.

Why buying by email is slow and risky

Halden Robotics builds warehouse robots and buys a few hundred components a month: standoffs, connectors, motor drivers. For each request, someone emails three approved suppliers, waits for the quotes, copies unit prices and lead times into a spreadsheet, gets a manager's yes, and sends the purchase order. Each cycle takes a week, mostly waiting and copying.

An agent can do this work on two conditions. It writes only to suppliers on the approved list, because a purchase order sent to the wrong address is a real liability. And the purchase order waits for a person's approval, because the agent is spending money.

halden-purchasing@blueping.dev meets both in the API itself. Send allow rules make every other recipient impossible, one thread per supplier keeps each quote apart, attachments read as text whatever their format, and the purchase order waits as a draft until a person sends it.

From a request for quote to an approved purchase order

The agent compares and drafts; the person approves; Blueping enforces who can be written to.

  1. Approve the suppliers once

    One send allow rule per supplier domain. With allow rules in the send direction, a message to any other address stops before it leaves, whatever the agent was told.

    Call: POST /v1/inboxes/{id}/rules with direction: send, action: allow and value

    Answer: 201 with the rule

    Checked: One refused recipient stops the whole message with 403 recipient_blocked

  2. Send the request for quote

    One email per supplier, with the parts as a CSV attachment and an Idempotency-Key per supplier, so a retried run never sends a second request. Each email starts its own thread.

    Call: POST /v1/inboxes/{id}/messages with attachments and Idempotency-Key

    Answer: 202 with each message's id and thread_id

    Checked: Each supplier who never wrote counts as a new recipient: 3 in the first hour, 10 in the first day and 25 in the first week after the claim

  3. Label the round

    The agent labels each thread with the request's id, such as rfq-118, so the quotes that come back are found in one call however many suppliers answer.

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

    Answer: The thread's labels

    Checked: A thread's labels are its messages' labels together

  4. Read the quotes

    The agent lists the round's threads, reads each supplier's reply, and opens the attached quote as text, whether it came as Excel, PDF or CSV.

    Call: GET /v1/inboxes/{id}/threads?labels=rfq-118, GET /v1/threads/{id}, then the attachment's /text

    Answer: The round's threads, each thread's messages, then each file's text

    Checked: A held reply is counted in its thread's held_count and left out of messages, so it never enters the comparison

  5. Draft the purchase order for approval

    The agent writes the purchase order as a reply to the winning quote, without send_at, so it waits. A person reads it with GET /v1/drafts/{id}, or asks for it over MCP, and sends it.

    Call: POST /v1/inboxes/{id}/drafts with reply_to_message_id, then POST /v1/drafts/{id}/send

    Answer: 201 with status: draft, then 202 with the sent message

    Checked: Sending a draft runs every check a send runs, the allow rules included

What a send to a supplier off the list answers, whole. Nothing leaves:

{
  "error": {
    "code": "recipient_blocked",
    "message": "This inbox sends only to the addresses its allow rules name, and quotes@unlisted-parts.example isn't one. Nothing was sent.",
    "next_action": "Remove that address from the message, or add a send rule that allows it: POST /v1/inboxes/{id}/rules.",
    "docs_url": "https://blueping.dev/docs/errors#recipient_blocked"
  }
}

Requests for quote and comparison in Python and Node.js

Two steps in one program: send sets the rules and mails the request for quote to each supplier, and collect compares the quotes and drafts the purchase order. The parts list, the suppliers and the price pattern are this example's; your model reads real quotes in any layout.

# rfq.py: send a request for quote to approved suppliers, then compare the quotes that come back.
# Run: python rfq.py send, and once the quotes are in, python rfq.py collect
# pip install requests
import base64
import os
import re
import sys

import requests

API = "https://blueping.dev/v1"
RFQ = "rfq-118"
SUPPLIERS = ["quotes@corbel-components.example", "sales@kessler-fasteners.example", "rfq@nordmark-parts.example"]
ITEMS = "part,quantity\nM3x10 brass standoff,500\nM3 steel hex nut,1000\n"
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['BLUEPING_API_KEY']}"

inbox = session.post(f"{API}/inboxes", json={"client_id": "procurement", "display_name": "Halden Robotics Purchasing"}).json()

if sys.argv[1] == "send":
    for supplier in SUPPLIERS:  # the inbox may write to these domains and nobody else
        rule = {"direction": "send", "action": "allow", "value": "@" + supplier.split("@")[1]}
        session.post(f"{API}/inboxes/{inbox['id']}/rules", json=rule)
    parts = {"filename": f"{RFQ}.csv", "content_type": "text/csv", "content_base64": base64.b64encode(ITEMS.encode()).decode()}
    for supplier in SUPPLIERS:  # one email each, so every quote stays in its own thread
        sent = session.post(
            f"{API}/inboxes/{inbox['id']}/messages",
            json={"to": supplier, "subject": f"Request for quote {RFQ.upper()}", "text": "Please quote unit price and lead time for the attached parts, in this thread.", "attachments": [parts]},
            headers={"Idempotency-Key": f"{RFQ}-{supplier}"},
        ).json()
        session.patch(f"{API}/threads/{sent['thread_id']}", json={"add_labels": [RFQ]})
        print("rfq sent to", supplier)

if sys.argv[1] == "collect":
    quotes = []
    threads = session.get(f"{API}/inboxes/{inbox['id']}/threads", params={"labels": RFQ}).json()
    for thread in threads["data"]:
        for message in session.get(f"{API}/threads/{thread['id']}").json()["messages"]:
            if message["direction"] != "in" or message["auth"]["verdict"] != "pass":
                continue  # quotes from proven suppliers only
            for file in message["attachments"]:
                read = session.get(f"{API}/messages/{message['id']}/attachments/{file['id']}/text").json()
                if "error" in read or read["safety"]["verdict"] != "clear":
                    continue  # no text to read, or text that speaks to a model: it stays out of the comparison
                price = re.search(r"standoff[^\n]*?[,|]\s*([0-9]+\.[0-9]+)", read["text"], re.IGNORECASE)
                if price:
                    quotes.append((float(price.group(1)), message["from"]["address"], message["id"]))
    for price, supplier, _ in sorted(quotes):
        print(f"{supplier}: {price:.2f} a standoff")
    if quotes:
        price, supplier, message_id = min(quotes)
        draft = session.post(
            f"{API}/inboxes/{inbox['id']}/drafts",
            json={"reply_to_message_id": message_id, "text": f"Purchase order PO-118: 500 standoffs at {price:.2f}. Please confirm the delivery date."},
            headers={"Idempotency-Key": f"po-{RFQ}"},
        ).json()
        print("purchase order draft", draft["id"], "for", supplier, "waits for a person to send it")

The purchase order is a draft with no send_at: it waits until someone sends it with POST /v1/drafts/{id}/send, or with send_draft over MCP. A draft whose request repeats with the same Idempotency-Key comes back as the same draft, so collect can run as often as quotes arrive.

In its first hour after the claim, an agent reaches 3 people who never wrote to it, and the ramp widens after that: Limits has every step. Suppliers who answered an earlier round never count again.

Buy from a conversation with an MCP client

A buyer can run the round from Claude or Cursor with the MCP server connected. The tools send text; the parts list goes in the body, and files go through the API as above.

From halden-purchasing, send a request for quote to our three approved suppliers for 500 M3x10 brass standoffs and 1000 M3 steel hex nuts, one email each, and label the threads rfq-118. When the quotes are in, compare unit price, lead time and minimum order, and write the purchase order to the best one as a draft. Don't send it: I will approve it.
ToolWhat it does here
add_address_ruleAdds the send allow rules for the approved suppliers, with your go-ahead.
send_emailSends each request for quote, in a thread of its own.
label_threadLabels each round's threads with its id.
list_threadsFinds the round's threads by label.
read_attachmentReads each quote's Excel, PDF or CSV file as text.
create_draftWrites the purchase order without sending it.
send_draftSends it, once you say so.

Rules change who the agent can reach, so add_address_rule asks the model to check with you first, and a send to an unapproved supplier fails with recipient_blocked whatever the conversation says.

Log each quote the moment it lands

Buyers like to see quotes arrive. Subscribe to email.received, check the signature as Webhooks shows, and let the handler below log each quote in a thread of the round, so your purchasing tool shows the comparison filling in.

// quote-hook.mjs: the part of your webhook server that logs each supplier quote as it arrives.
// 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 get = async (path) => (await fetch(API + path, { headers })).json();

export async function handle(event) {
  if (event.type !== "email.received") return;
  const { message } = event.data;
  const thread = await get(`/threads/${message.thread_id}`);
  const round = thread.labels.find((label) => label.startsWith("rfq-"));
  if (!round) return;
  for (const file of message.attachments) {
    const read = await get(`/messages/${message.id}/attachments/${file.id}/text`);
    const price = (read.text ?? "").match(/standoff[^\n]*?[,|]\s*([0-9]+\.[0-9]+)/i)?.[1];
    console.log(`${round}: ${message.from.address} quotes ${price ?? "an unread price"}`); // your purchasing tool here
  }
  await fetch(`${API}/messages/${message.id}`, { method: "PATCH", headers, body: JSON.stringify({ add_labels: ["quote"] }) });
}

The thread's labels carry the round, so the handler knows which request a quote answers without any state of its own.

Spending money safely by email

In procurement an agent's mistake costs money, so the controls sit in the API, where a prompt can't reach them.

Only approved suppliers can be written to

Send allow rules are checked before anything goes out. A purchase order addressed to any other domain stops with 403 recipient_blocked, even if a supplier's email asks the agent to send it elsewhere.

A person sends the purchase order

The agent drafts and a person sends. Until then the draft can be read, changed or deleted, and nothing has left the inbox.

Quotes from impostors

A reply forged in a supplier's name fails the supplier's DMARC policy: it is turned away or held as unauthenticated, and never appears among the round's messages. The program also skips any quote whose auth.verdict isn't pass, so a fake low quote can't win.

Payment instructions stay with people

A quote that asks for payment to a new account is a question for your finance team. The agent's prompt should stop on any change of bank details.

Files that speak to a model

Each quote's text carries a safety result. A spreadsheet with hidden instructions comes back suspicious and stays out of the comparison.

What a purchasing desk needs

Twenty rounds a month with three suppliers each send 60 requests for quote, plus 20 purchase orders and a few follow-ups, about 100 sends. Quotes are small files, so one inbox and a little storage cover it.

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 NylasAll use cases

Last checked against the API on .

Questions about buying by email

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

Read the docs

Can the agent attach files over MCP?

The MCP tools send text and HTML. Files go through the API: attachments on POST /v1/inboxes/{id}/messages, on replies and on drafts, 10 MB per message.

How do quotes stay apart?

Each request goes as its own email, so each supplier's answer lands in its own thread. The round's label finds all of them in one call.

Can a person approve before the purchase order goes?

Yes. A draft without send_at waits. POST /v1/drafts/{id}/send sends it with every check a send runs, and DELETE /v1/drafts/{id} throws it away.

Which quote formats can it read?

PDF, Word, Excel and CSV come back as Markdown, and text or JSON as they are. Images come back as 415 text_unavailable with the route that downloads them.

What if a supplier answers from a new address?

The reply threads by its headers, so it lands in the round's thread. Allow rules work by domain, so a new address at an approved domain can still be answered.

Why didn't a request to one more supplier go at once?

New recipients come a few at a time after the claim: 3 in the first hour, 10 in the first day and 25 in the first week. A request past the ramp is accepted with status queued and a sends_at, and goes by itself when it fits. Suppliers who wrote to the inbox before never count, so the second round goes out at once.

Let your agent run the quotes

Requests for quote, comparisons and a purchase order for you to send.