What the agent does
This is for a company that sells invoicing software to plumbers, electricians and other trades. When a contractor finishes a job, the software emails the homeowner the invoice through the company's Resend account, from one sending address, with a subject like Invoice INV-2214 from Ridgeline Plumbing. When the homeowner's address was typed wrong or their mailbox refuses it, the invoice never arrives, the contractor waits for money nobody knows they owe, and Resend adds the address to the account's suppression list so later emails to it are not sent at all. The support team wants a Monday list of those invoices, by contractor, so each one hears about it before they start chasing a customer who never got the bill.
The run names one connection, resend, which a support lead signed in to through Resend's own OAuth page on its hosted MCP server. The agent calls list-suppressions twice, with origin set to bounce and then to complaint, following after through every page, and keeps the entries whose created_at falls in the last seven days. A bounce means the address could not take mail; a complaint means the homeowner marked an earlier email as spam, which is a different conversation for the contractor to have.
To tie each address to an invoice, it calls list-emails with limit 100 and pages back through the week's sent emails, reading each one's recipient, subject, status (Resend's last_event) and sent time. Every email sent to a suppressed address in the week whose subject starts with Invoice is one row: the contractor's business name and the invoice number come from the subject, which the software writes the same way every time. Emails whose status is bounced or complained but whose address is not on the list yet are added too, marked as not suppressed, and so are emails with status suppressed: invoices Resend did not send at all because the address was already on the list from an earlier week.
It writes bounced-invoices.csv (contractor, invoice number, recipient, sent at, status, suppression origin, suppressed at) and bounced-invoices.md, grouped by contractor with a two-line note support can send each one: which invoice did not arrive, the address it went to, and a request to check it with their customer. It sends nothing and removes nothing from the suppression list; Resend's own tool description warns that sending to an address suppressed for a bounce or complaint can hurt deliverability, and the prompt forbids remove-suppression outright.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "List this week's invoice emails that bounced or drew a spam complaint. Use the resend connection. Week: 2026-11-09T00:00:00Z to 2026-11-16T00:00:00Z. 1) Call list-suppressions with origin bounce, then origin complaint, limit 100, following after until there are no more; keep entries with created_at in the week. 2) Call list-emails with limit 100 and page through every email sent in the week (stop when created_at is before the week). 3) For each email whose recipient is a kept suppression, or whose status is bounced, complained or suppressed, and whose subject starts with 'Invoice ', make one row: parse the subject 'Invoice <number> from <business>' into invoice number and contractor; recipient, sent at, status, suppression origin and suppressed at (blank and marked not suppressed if absent). Write bounced-invoices.csv with those columns and bounced-invoices.md grouped by contractor, each with this note filled in: 'Your invoice <number> to <recipient> was not delivered on <date>. Could you check the address with your customer? We can resend it once it is fixed.' List emails whose subject you could not parse separately. Do not call send-email, send-batch-emails, remove-suppression, batch-remove-suppressions, add-suppression, or any tool that sends, creates, updates or removes anything.",
"connections": [
"resend"
]
}- 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.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions. The run starts in its own cloud sandbox.
- 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
bounced-invoices.md lists each contractor's undelivered invoice emails, the address each went to, and why it failed. It comes back as an artifact on the session alongside bounced-invoices.csv. For each invoice it says whether it bounced or drew a complaint and gives the note ready to send, with a short section at the end for any invoice email whose subject did not follow the usual pattern.
What support checks before sending a note: that the contractor has not already fixed the address and resent the invoice by another route; that a complaint is handled as a complaint (the homeowner got the email and marked it as spam, so the address is fine) rather than as a typo; and, before anyone removes an address from the suppression list to resend, that the new address is confirmed. Removing a suppression is a decision support makes in Resend, not one the run makes.
Run it on every Monday morning
The support lead saves the agent with POST /o/{org}/agents, naming the resend connection and the instructions above with "the seven days before today" in place of the dates, and adds a console automation with a schedule trigger, cron 0 8 * * 1 and the team's timezone. A schedule fills nothing into the prompt, so the subject pattern and the note live in the saved instructions.
At month end, when contractors send most of their invoices, the lead can add a second schedule on the second day of each month with a two-day window, so the month's last invoices are caught before the weekly list.
The use case this job follows, with its automation and trigger: Produce a report or file, no repo.
Why run it on Rush?
The Resend account that sends every customer's invoices can also send any email, change domains and create API keys, so its sign-in should not sit in a script on a support laptop. On Rush the sign-in stays in the connection, the prompt keeps the run to the read tools, and the run's record lists every tool call, so the team can see that nothing was sent or removed.
Each Monday's run has its own computer and a record of what its model calls cost. Paging through a week of sent email is slow by hand and quick for an agent, and the list it writes is grouped the way support works, by contractor, rather than by address the way Resend stores it.
Frequently asked questions
Why read the suppression list as well as the sent emails?
The suppression list says which addresses Resend will no longer send to and why, with the date it happened. The sent emails say which invoice went to that address. Together they give support a row per undelivered invoice.
Can the agent resend the invoice to a fixed address?
Not in this job. The prompt forbids every sending tool. Once a contractor confirms the right address, the invoicing software resends the invoice the way it always does.
What if our subjects are written differently?
Change the pattern in the prompt. Emails whose subject does not match are listed in their own section, so a change in the template shows up as a list to look at rather than missing rows.
Does this need a Resend API key?
No. Resend's hosted MCP server signs in through OAuth by default, and Rush keeps that sign-in in the connection. An API key in a Bearer header is Resend's option for clients without a browser sign-in.
More Resend jobs
More jobs like this: Produce a report or file, no repo
- Which Clients Still Owe Us Documents? An Accounting Firm's Weekly Check of Client Folders in OneDrive (OneDrive)
- What's Still Open on Each Deal Closing in the Next 10 Days? A Real Estate Brokerage's Monday Checklist From ClickUp (ClickUp)
- Turn a Week of Carrier Renewal Emails in Outlook Into One Renewal List for Your Agency (Outlook)