What the agent does
This is for a company that sells marketing software to hair salons, nail bars and barbers that take payments and keep their client list in Square. A birthday message with a small treat is the one piece of marketing most salon owners agree works and almost none keep up, because it means checking the client list every week. The software adds a weekly birthday list: every Sunday evening, each salon gets the clients with a birthday in the coming week and a draft message for each, written in that salon's tone, to approve and send from the software.
The company connects a Square account of its own and saves the agent once as a template with POST /o/{org}/agents, naming square in connections, with instructions that keep it to reading. When a salon turns the feature on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "birthdays-<salon id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "square"}, and opens the authorize_url in a popup while the owner is signed in to the software. The owner signs in on Square's own page, so the company registers no Square application and stores no Square token, only the agent id against the salon.
Square's hosted MCP server connects to the Square API and reaches production accounts only. On a run the agent reads the salon's customers through the Customers API's list, GET /v2/customers, 100 a page with the cursor from each page, and keeps customers whose birthday falls in the coming week. Square's Customer reference gives birthday in YYYY-MM-DD format and uses the year 0000 when the year is unknown, so the agent matches on month and day only and never works out an age. It reads given_name, email_address, phone_number and note for each match.
For each birthday client it also reads their recent visits from the salon's payments or bookings, whichever the salon uses, to note their last visit and usual service, then drafts a message of two or three sentences in the tone the salon chose in settings, with the offer the salon set (for example a free fringe trim this month). It returns the list as JSON for the software to show. It never sends a message, never edits a customer, and never creates a discount or gift card in Square.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Weekly birthday list for this salon. Coming week: Monday 2026-11-23 to Sunday 2026-11-29. Tone: friendly and short, first names, no emojis. Offer: 'a free deep-conditioning treatment with any cut in December'. Read only. 1) List customers with GET /v2/customers, limit 100, following cursor to the end. 2) Keep customers whose birthday month and day fall in the coming week (birthday is YYYY-MM-DD; year may be 0000; never compute or mention an age). 3) For each, list their payments or bookings from the last 12 months at location LX4RQ9 to find the last visit date and the most common service. 4) Draft a 2 to 3 sentence message using the first name, the offer and, if known, their usual service. Return JSON only: {clients: [{customer_id, given_name, birthday_month_day, email_address (omit if none), phone_number (omit if none), last_visit (omit if none), usual_service (omit if none), message}]}. Leave out customers with neither email nor phone. Never send anything, never update a customer, never create a discount, gift card or order."
}- 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
The run drafts a birthday message for each of next week's clients in the salon's tone, beside their contact details, last visit and usual service. The answer is JSON in the session's result and in the run.completed webhook the company's API key sends: one entry per client with a birthday in the coming week, its usual service where Square shows one, and a short message using the salon's offer. The software shows the list on the salon's dashboard with an Approve button beside each message.
What the salon owner checks before approving: clients who asked not to be contacted, which the salon may have recorded in a note rather than in Square's own marketing preferences; a client who has not visited in a year and may have moved; and a message that names a service the client no longer has. The software sends the approved messages through its own SMS or email provider, under the salon's name.
Run it on every Sunday evening, per salon
The software's scheduler sends one POST /o/{org}/sessions per salon at six on Sunday evening in the salon's time zone, with that salon's agent id as agent, the coming week's dates, tone and offer in input, and a request_id that is a UUID v5 of the salon id and the week, so a retried job does not draft the same week twice.
Three hundred salons means three hundred small runs on Sunday evening. Past the API key's concurrent limit they wait queued and start in turn, and each list arrives on the webhook, so the scheduler sends them all at once.
The use case this job follows, with its automation and trigger: Draft outreach from your CRM.
Why run it on Rush?
Each salon owner signs in on Square's page, and that sign-in belongs to their salon's agent alone: no run can read another salon's clients, and the company's own runs never see them. A salon that cancels is one DELETE /o/{org}/agents/{agent}, which disconnects its Square. The session's accounts names the Square connection each run used, which answers an owner who asks what the software read.
Each run has its own computer and a record of every Square call, so when an owner asks why a client was missed, the company opens that week's session and sees the customer pages it read. Adding up total_cost_usd over GET /o/{org}/sessions?agent=<agent id> shows what the feature costs per salon, which the company can price into its plan.
Frequently asked questions
Why match on month and day only?
Square stores a birthday with the year 0000 when the client did not give one, and many salons record only the day and month. Matching on both keeps those clients in, and leaving ages out of the message avoids an awkward line.
Could the agent send the messages through Square?
The template's instructions forbid any write, and Square's hosted server reaches the salon's live account. Sending stays in the company's own messaging, where the salon approves each one and the company already handles opt-outs.
What about clients who opted out of marketing?
The software keeps its own opt-out list and drops those clients before showing the drafts. A salon that records opt-outs in Square can say so in settings, and the template's instructions tell the agent to leave those customers out.
Does the salon need a particular Square plan?
The agent reads customers, payments and bookings through the salon's own Square account, so it sees what that account holds. A salon that does not use Square Appointments is read from payments instead.