What the agent does
This is for a company that sells marketing or ordering software to independent restaurants, cafes and bars. Each week the owner types the specials into the software: a soup, a fish of the day, a happy-hour deal, a Sunday brunch dish. Posting them on Instagram, Facebook and the rest is the job that gets skipped on a busy week. Many owners already schedule posts in Buffer, so the company saves one agent as a template whose connections name buffer, and makes one agent from it per restaurant, storing its id against the restaurant's account.
Each restaurant connects its own Buffer once. The software's backend calls POST /o/{org}/agents/{agent}/connections {"type": "app", "name": "buffer"} and opens the authorize_url in a popup; the owner signs in on Buffer's page. Rush signs in with its own Buffer app client, so the software company registers no Buffer app and stores no token, and the agent reaches Buffer's GraphQL API at api.buffer.com signed from outside its computer.
On a run, the agent reads the restaurant's Buffer organizations with the account { organizations { id name } } query and its connected channels with channels(input: {organizationId}), which returns each channel's id, name, service and isQueuePaused. It keeps the channels the owner picked in the software, skips any whose queue is paused and says so. Then it writes one post per special per channel, in the restaurant's own voice from the examples in the input, fitted to each channel's service, and never a claim the owner did not give, such as "locally sourced" or a health benefit.
It saves each one with the createPost mutation and saveToDraft: true, so every post lands in Buffer as a draft and nothing is published. It returns the list of drafts it created, with each post's id, channel and text, and any MutationError message Buffer sent back instead of a post. It changes no post that is already in the restaurant's queue.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "<agent id>",
"input": "Restaurant: Harbor Street Kitchen. Voice: warm, short, a little playful; no hashtags except #HarborStreetEats; examples: 'Soup's on. Roasted tomato and fennel, all week.' / 'Tuesday means tacos. You know the drill.' Specials this week: Mon-Fri roasted squash soup with sage brown butter; Thu-Sat grilled halibut with lemon caper butter; Fri 4-6pm happy hour, half-price draft beer; Sun brunch, ricotta pancakes with blueberry compote. Channels to use: instagram, facebook. Read our Buffer organizations and channels; skip channels whose queue is paused and tell me. Write one post per special per channel, using only the facts above. Save each with createPost and saveToDraft true. Do not publish, schedule or edit any existing post. Return JSON: {drafts: [{post_id, channel, special, text}], skipped_channels: [string], errors: [string]}."
}- 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, with your repository as the resources URL. 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 answer is JSON in the session's result and in the run.completed webhook, and the drafts are in the restaurant's Buffer. The software tells the owner the drafts are ready in Buffer and shows the list; the owner opens Buffer, adds a photo of the dish, edits a word and schedules the ones they like. Nothing reaches a customer until the owner does that.
What the owner checks: prices and days, which the agent copies from the input and which are the most common thing to change after the specials were typed; the voice, which improves as the owner adds better examples in the software; and skipped_channels, which usually means a paused queue or a channel that needs reconnecting in Buffer. The transcript records every GraphQL call the run made.
Run it on every week, per restaurant
When an owner saves the week's specials, the software sends one POST /o/{org}/sessions with that restaurant's agent id and the specials in input, and a request_id that is a UUID v5 of the restaurant's id and the week, so saving the same specials twice does not create a second set of drafts.
An owner who changes a special mid-week saves again with a new version in the software, which sends a new request id. The key's webhook delivers each answer, and the software shows the new drafts beside the old ones so the owner can delete the stale ones in Buffer.
The use case this job follows, with its automation and trigger: Run an agent per customer task.
Why run it on Rush?
Writing every special for every network is a small job that a busy owner skips, and a fill-in-the-blanks template reads like one. The agent writes in the restaurant's voice from its own examples, sticks to the facts it was given, and saves drafts where the owner already schedules posts, so the owner's part is approving rather than writing.
Each restaurant's Buffer belongs to its own agent: its runs reach that Buffer only, and a mistake in one restaurant's run cannot post to another's account. The software keeps one template, and GET /o/{org}/sessions?agent=<agent id> lists one restaurant's runs with what each cost, which the company can use to price the feature.
Frequently asked questions
Will the agent publish posts?
No. The prompt saves every post as a draft with saveToDraft: true and forbids publishing or scheduling. The Buffer sign-in can schedule posts, so the rule is in the template's instructions and the prompt, and the transcript shows every mutation.
Can it add photos of the dishes?
This prompt writes text only, and the owner adds a photo in Buffer before scheduling. Food photos are better taken by the restaurant than invented by anyone.
What if the restaurant has no Buffer account?
Then this feature does not apply to them. A run of an agent made from this template needs its Buffer connected, so the software would keep a second template with no connection that returns the drafted text in the app instead.
Does the restaurant need a Rush account?
No. The owner signs in to Buffer only. The agent, its runs and its cost belong to the software company's API key creator.