All jobs

Match Signed Rate Confirmations in Each Freight Broker's Outlook to Their Loads

Software for freight brokers makes one agent per broker that reads signed carrier rate confirmations in their Outlook and matches each to a load and rate.

Run this on RushOpens the console with this prompt ready to send. Connect Outlook there first.

What the agent does

This is for a company that sells transportation management software to small freight brokerages. When a broker books a carrier, the software sends a rate confirmation; the carrier signs it and emails it back, usually as a PDF, to the broker's Outlook. Someone then opens each email, finds the load number, checks the rate against what was agreed and marks the load confirmed. The company saves one agent as a template that names Outlook at the read level, "connections": [{"name": "outlook", "access": "read"}], and makes one agent from it for each broker who turns the feature on.

The broker connects their mailbox once: the backend calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "outlook"} and opens the returned authorize_url in a popup, where the broker signs in on Microsoft's page. Rush asks Microsoft for the read level's permissions, Microsoft Graph's Mail.Read and Contacts.Read, and the software company never holds a token or registers a Microsoft app.

Each run is given a time window and the broker's open loads from the software: load number, carrier name, carrier MC number, agreed rate, pickup and delivery dates. The agent calls Graph's GET /me/messages with a $filter on receivedDateTime and hasAttachments eq true, reads each candidate's subject and sender, and fetches its files with GET /me/messages/{id}/attachments, decoding each PDF's contentBytes. It reads the PDF and pulls out the load number, carrier name and MC number, the total rate with any line items such as detention or a lumper fee, the dates, and whether the carrier's signature block is filled in.

It matches each document to an open load by load number first, then by carrier and pickup date when the number is missing, and compares the rate on the document to the agreed rate. Every match is returned with a status: matches, rate differs (with both figures), or no matching load. Emails that are not rate confirmations, such as invoices or proof-of-delivery scans, are counted and left alone. The agent sends no email and changes nothing in the mailbox.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "<agent id>",
  "input": "Read mail received since 2026-11-13 12:00 UTC that has attachments. Open loads (load number, carrier, MC, agreed rate USD, pickup date): L-48211, Redline Transport, MC 812345, 2150, 2026-11-14; L-48219, Blue Mesa Freight, MC 760021, 1875, 2026-11-15; L-48224, Hollis Carriers, MC 903377, 3020, 2026-11-17. For each PDF attachment that is a carrier rate confirmation, extract load number, carrier name, MC number, total rate and its line items, pickup and delivery dates, and whether the carrier signature is filled in. Match it to an open load by load number, else by carrier and pickup date. Return only JSON: {confirmations: [{message_id, received, file, load_number, carrier, mc, total_rate, line_items, signed, match: matches|rate_differs|no_match, agreed_rate}], skipped: number}. Send no email."
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

The answer is JSON in the session's result and in the run.completed webhook. The software marks each load whose confirmation matches as confirmed, puts a rate difference in front of the broker with both figures and the document, and lists confirmations that match no load. Nothing is marked confirmed without the broker seeing anything that differs.

What the broker checks: every rate_differs, which usually means an accessorial charge was added; any confirmation where signed is false; and matches made by carrier and date instead of load number. The session's accounts records which mailbox it read, and the transcript shows each Graph call and attachment, so a wrong match can be traced to the document.

Run it on every half hour, per broker

The software's scheduler sends one POST /o/{org}/sessions per connected broker every half hour during the working day, with that broker's agent id, the window since the last run and the broker's open loads in input, and a request_id that is a UUID v5 of the broker's id and the window start, so a retried job does not read the same window twice. Runs past the key's concurrent limit are created queued and start as earlier ones finish.

The webhook handler verifies the Standard Webhooks signature, finds the broker by the execution_id it stored at start, and applies the matches to that broker's loads.

The use case this job follows, with its automation and trigger: Run an agent per customer task.

Why run it on Rush?

A rate confirmation is a PDF the carrier's own software produced, and every carrier's looks different: one puts the load number in the header, another in a reference field, a third only in the email subject. Reading them is a person's job today because a template-based parser breaks on the next carrier. The agent reads each document the way the broker would and returns the fields with the file they came from.

Each broker's mailbox holds their customers' rates and their carriers' details, so it stays with that broker's own agent: its runs see that mailbox only, and the software company's own runs never do. Each run has its own computer and its own record, and GET /o/{org}/sessions?agent=<agent id> lists one broker's runs and what each cost.

Frequently asked questions

Can the agent reply to the carrier?

Not with this template: it asks for the read level, and the prompt says to send no email. Microsoft can still issue a token with every Outlook permission the broker granted Rush earlier, so the transcript records every call for anyone who wants to check.

What if the carrier pastes the confirmation in the email body instead of attaching it?

This prompt filters on hasAttachments, so those are not read. Drop that filter from the prompt and tell the agent to read bodies too, at the cost of reading more mail per run.

Does it check the carrier's authority or insurance?

No. It reads the MC number on the document and compares it to the one on the load. Vetting a carrier stays in the broker's own process.

What happens to a confirmation that matches no load?

It is returned with match: no_match and the fields it read, so the broker can see whether the load was entered under another number or the carrier sent it to the wrong broker.

More Outlook jobs

More jobs like this: Run an agent per customer task

Keep reading