All jobs

Which Client Posts Failed to Publish Overnight? A Social Media Agency's Morning Check of Every Buffer Channel

A social media agency runs an agent each weekday morning that finds every Buffer post that failed to publish, and every channel that will fail next, by client.

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

What the agent does

This is for a social media agency that runs posting for twenty or thirty small clients: a dental group, two restaurants, a gym, a law office, a few online shops. Every client's Instagram, Facebook, LinkedIn and TikTok channels sit in the agency's Buffer, and the queues are filled a week or two ahead. A post that fails to publish does not shout: a client who changed their Facebook password or removed a page admin disconnects the channel, and every post due on it fails quietly until someone notices. Usually the client notices first. The agent looks every weekday morning, before the account managers start, and lists what failed and what is about to.

The agency's operations lead connects Buffer once with POST /me/connections {"type": "app", "name": "buffer"} and signs in on Buffer's own page. The agent reaches Buffer's GraphQL API at api.buffer.com with that sign-in, signed from outside its computer, so no Buffer token sits in the agent's files. The request names buffer in connections, because a run started with an API key gets only the connections it names.

On a run the agent reads the organizations and the channels in each, with isDisconnected, isLocked and isQueuePaused, the three channel fields Buffer's reference uses for a channel that is not properly connected, a locked channel and a paused queue. It then queries posts for each organization with the filter set to status error and dueAt from the previous morning, and reads each failed post's text, dueAt, channel and error, whose message is Buffer's explanation and whose supportUrl links the help article for that error. Buffer's posts guide describes the error status as a post that "could not be published (e.g., the channel was disconnected)".

Last, it queries scheduled posts due in the next 72 hours on any channel that is disconnected, locked or paused, because each of those will fail or sit unsent unless someone acts today. It groups everything by client, using the organization or a channel-to-client list in the request, and writes failed-posts.md: per client, the failed posts with their due time, the error message and help link, and the posts at risk. It changes nothing in Buffer: it does not retry, reschedule, edit or delete a post, and it never publishes.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Morning failed-post check for Brightline Social. Today is Monday 2026-11-23, time zone America/Chicago; look back to Friday 2026-11-20 08:00. Use the buffer connection. 1) Read account organizations, then every channel in each with name, service, isDisconnected, isLocked, isQueuePaused. 2) For each organization, query posts with filter status [error] and dueAt from 2026-11-20T08:00 America/Chicago to now, following pageInfo; read id, text, dueAt, channelId, error { message supportUrl }. 3) Query posts with status [scheduled] and dueAt in the next 72 hours; keep those on a channel that is disconnected, locked or paused. Client is the organization name, except channels named in this list: 'Harbor Dental IG' and 'Harbor Dental FB' = Harbor Dental Group. Write failed-posts.md grouped by client, clients with problems first: a one-line summary, then failed posts (channel, service, due time, first 80 characters of text, error message, supportUrl), then posts at risk with the channel's problem. End with a list of channels to reconnect, with the client. Read only: never edit, retry, reschedule, delete or publish a post, and never change a channel.",
  "connections": [
    "buffer"
  ]
}
  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 session's artifacts hold failed-posts.md: for each client with a problem, the posts that failed since the last check with their due time, the opening of the text, Buffer's error message and the help article it links, then the scheduled posts in the next three days that sit on a channel that is disconnected, locked or paused. The last section is the list of channels someone must reconnect, by client, which is usually the morning's real work.

What the account manager checks before acting: whether a failed post still makes sense to publish late (a lunch special from Friday does not), whether the client already knows their channel is disconnected, and whether a paused queue was paused on purpose, say for a client who asked to stop posting during a crisis. Reconnecting a channel needs the client's own login in most cases, so the account manager sends the client a short note; the agent does not contact anyone.

Run it on every weekday morning before account managers start

In the console, a Project automation with a schedule trigger, cron 30 7 * * 1-5 and the agency's timezone, runs a saved agent whose connections name buffer with this prompt. A schedule fills no date into the prompt, so the saved instructions say "since the last weekday at 08:00" and the agent works the window out itself; Monday's run covers the weekend.

When the agency signs a new client, it adds their channels in Buffer and, if the organization name is not the client's name, one line to the saved agent's channel list. The next morning's run includes them with no other change, and each morning's session stays as the record of what failed that day.

The use case this job follows, with its automation and trigger: Produce a report or file, no repo.

Why run it on Rush?

The Buffer sign-in lives in Rush's connection, not in a personal access token pasted into a script on the operations lead's laptop, and the agent's calls to api.buffer.com are signed outside its computer. When the lead leaves the agency, the connection is removed or replaced in one place, and the morning check does not stop because a laptop was wiped.

A script could list error posts, but it would not tell a client's disconnected Facebook page from a one-off rejection, or group thirty clients' problems into something an account manager reads in two minutes. Each run has its own computer and a record of every query it made, so when a client asks why a post never went out, the agency opens that morning's session and sees what Buffer said. Its total_cost_usd shows what the check costs per morning.

Frequently asked questions

Can the agent republish the failed posts?

Buffer's API has mutations to edit, move and publish posts, and Rush's Buffer sign-in includes posts:write, but this prompt forbids all of them. A failed post often needs a person's judgement, such as a dated offer that should be dropped, and a post on a disconnected channel fails again until the client reconnects it.

Does it read post engagement or analytics?

No. Buffer's post metrics guide says metrics are only available with a personal API key, and Rush's Buffer sign-in is an app client, so this check sticks to statuses, errors and channels, which the app client can read.

How does it know which client a channel belongs to?

By the Buffer organization it sits in, or by the channel names listed in the prompt when the agency keeps several clients in one organization. A channel it cannot place is listed under unassigned instead of being guessed.

What if nothing failed?

The file says so in one line and still lists any channel that is disconnected, locked or paused, since those fail later. The account managers can skip it on a quiet morning.

More Buffer jobs

More jobs like this: Produce a report or file, no repo

Keep reading