All jobs

Which Regulars Haven't Booked in a While? Barbershop Software That Finds Each Shop's Lapsed Clients in Square Appointments

A barbershop software company makes one agent per shop that reads the owner's Square bookings each Monday and lists regulars who are overdue and have nothing booked.

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

What the agent does

This is for a company that sells marketing and retention software to independent barbershops and small salons that take appointments in Square. A barbershop lives on regulars who come back every three or four weeks, and the ones who drift away rarely say so: they miss one cut, then another, and by the time the barber notices they have found someone closer to work. The owner wants a short list each Monday of who is overdue, by barber, while a friendly text can still bring them back. The software adds a Regulars check to its weekly summary, written by an agent that reads each shop's own Square account.

The company saves the agent once as a template with POST /o/{org}/agents, with "connections": ["square"] (it connects a Square account of its own first, because a template names connections its creator has) and instructions that keep it to reading. When a shop turns the check on, the backend calls POST /o/{org}/agents {"template": "<template id>", "name": "regulars-<shop id>"}, then POST /o/{org}/agents/{agent}/connections {"type": "mcp", "name": "square"}, and opens the authorize_url in a popup for the owner while they are signed in to the software. The owner signs in on Square's own page, so the company registers no Square application and holds no Square token.

Square's hosted server reaches production accounts only and has three tools: get_service_info to find a service's methods, get_type_info for a method's parameters, and make_api_request to call it. A run lists the shop's bookings through the bookings service. Square's list takes start_at_min and start_at_max and covers at most 31 days per request, so the agent reads the last 180 days in six windows and the next 60 days in two, with location_id for the shop and the cursor from each page. Each booking carries status (ACCEPTED, PENDING, NO_SHOW, CANCELLED_BY_CUSTOMER, CANCELLED_BY_SELLER or DECLINED), start_at, customer_id and appointment_segments, whose team_member_id names the barber.

From the past bookings it finds each regular: a customer with at least three ACCEPTED visits in 180 days. It works out their usual gap, the median number of days between visits, and flags anyone whose last visit is more than one and a half times that gap ago and who has no PENDING or ACCEPTED booking ahead. It reads each flagged customer's name and whether Square holds a phone number or email through the customers service, and the barber's name through the team service. For each it drafts a two-line text in the shop's voice from the owner's examples. It books, cancels and changes nothing, and it sends nothing.

Start it with one API call

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

{
  "agent": "<agent id>",
  "input": "Find regulars who have stopped booking at my shop, location L8XKQ2. Today is 2026-11-16. Use get_service_info and get_type_info as needed, then make_api_request, reads only. 1) List bookings for location L8XKQ2 from 2026-05-20 to 2026-11-16 in windows of at most 31 days (start_at_min, start_at_max), following cursor; then 2026-11-16 to 2027-01-15 the same way. 2) A regular has 3 or more ACCEPTED bookings in the past window. Their usual gap is the median days between those visits. Flag a regular if days since their last ACCEPTED visit is more than 1.5 times their usual gap and at least 30, and they have no PENDING or ACCEPTED booking after today. 3) For each flagged customer, retrieve the customer for given_name, family_name and whether phone_number or email_address is set; resolve the team_member_id of their last visit to the barber's name. Count their NO_SHOW bookings separately. Write regulars.md grouped by barber (name, visits, usual gap, days since last visit, last service date, no-shows) and regulars.json with the same fields plus a two-line draft text in this voice: 'Hey Marcus, been a minute. Chair's open Thursday after 4 if you want a cleanup. -Dre'. Do not create, update or cancel any booking, customer or message in Square."
}
  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. 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 run lists each barber's overdue regulars, with their usual gap between visits, how long it has been, and a draft text for each. The session returns regulars.md and regulars.json as artifacts. The software's webhook handler reads the JSON into that shop's Monday summary, with a button beside each draft text that opens it in the shop's own texting tool.

What the owner checks before sending: that a flagged regular has not moved away or told their barber they are taking a break, which Square does not know; that the draft sounds like the shop; and that the customer agreed to hear from the shop at the number on file. A customer who paid for walk-ins at the counter without a booking does not show in the bookings list, so a regular who stopped booking but still walks in may appear here. The list is a reason to reach out, not a record of who left.

Run it on every Monday morning, per shop

The software's scheduler sends one POST /o/{org}/sessions per shop with the check on, at 07:00 on Monday in the shop's time zone, with that shop's agent id as agent, its location id, today's date and the owner's voice examples in input, and a request_id that is a UUID v5 of the shop id and the week, so a retried job starts no second run. Runs past the key's max_concurrent wait as queued and start as slots free, and the key's webhook delivers each run.completed to the software.

A shop with two chairs and a shop with ten get the same request; the agent's run time grows with the number of bookings, and the software can read each run's cost from GET /o/{org}/sessions?agent=<agent id>.

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

Why run it on Rush?

Each shop's Square sign-in is that shop's own, stored in Rush's connection under that shop's agent. The software company runs no Square OAuth app and stores no tokens, and a run of one shop's agent cannot reach another shop's bookings or customers. Each session's accounts lists the Square connection it used, so the company can show an owner every run that read their account.

Each run has its own computer and a full record of every Square call it made with its arguments, which matters when a tool that can write is reading a shop's customer list. Because the server describes its services through get_service_info, the agent reads a new bookings field on its next run without a release of the software.

Frequently asked questions

Does every shop need Square Appointments?

Yes, for this check. It reads bookings, and a shop that takes only walk-ins has none. A shop that books in another tool and takes payment in Square would need a check built on payments instead.

Why read in 31-day windows?

Square's list of bookings takes a start_at_min and start_at_max no more than 31 days apart. Six windows cover the last six months and two cover the next two, each paged with its cursor.

Could the agent cancel or change a booking?

Square's hosted server can write, and Square documents a read-only switch only for its local server. The template's instructions and every prompt forbid any call that is not a read, and the run's record lists every make_api_request with its arguments.

Does the shop owner need a Square developer account?

No. The owner signs in to Square on Square's own page from the popup. Square's docs say its hosted server is in beta and that it keeps an allowlist of MCP clients, so the company tries the check on its own Square account before offering it.

More Square jobs

More jobs like this: Run an agent per customer task

Keep reading