Lesson 7 of 87 min read

Automate the boring part with code

Post from your own stack. Create drafts from CI on every release, let your coding agent draft the week, and approve everything before it goes live.

In this lesson you will

  • Decide which parts of posting to automate and which to keep human
  • Create a draft post from a script or CI job on release
  • Let your coding agent draft posts through an MCP connection, with approval

You automate your tests, your builds, your deploys and your dependency updates. Then you open a browser tab and type a release announcement by hand, three times, once per network. For a developer that should feel wrong.

It is wrong, but only half wrong. Some parts of posting are mechanical and belong in code: noticing a release happened, pulling the notes, creating drafts, tagging links, scheduling into slots. Other parts are judgment: is this worth posting, is the wording right, is anything in the screenshot private? This lesson shows how to automate the first kind from your own stack, and how to keep the second kind with a person, every time.

What to automate and what to keep

Draw the line before you write any code. Here is ours:

AutomateKeep human
Noticing a release, deploy or merged PRDeciding whether it deserves a post
Pulling release notes and links into a draftFinal wording and the first line
Creating drafts for each networkApproving each post before it goes live
Adding UTM tags to linksChecking screenshots for anything private
Putting approved posts into the next free slotReplying to people who respond

The rule underneath: automation creates drafts; a person publishes. A bot that posts directly on every release will, sooner or later, announce a broken build, a hotfix for a security issue you did not want to advertise yet, or a release note that says "fix stuff". A draft waiting for approval costs you one click and prevents all of that.

This is also how our product is built: nothing publishes to a network without an explicit publish action or an approval step. Workflows and agents draft and wait; publishing through the API needs a key that was given the publish scope on purpose. If you never give your automation that scope, a person is always the last step.

Option 1: drafts from CI on release

The most common setup: when you publish a release, your CI creates a draft post with the release notes, and you approve it later. Here is the shape using our public posting API. The endpoint and fields below are the documented ones from the posting API page; check the reference there for the full details and the base URL.

The minimum call creates a draft:

curl -X POST "$API_URL/v1/posts" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: release-v1.4.0" \
  -d '{
    "workspace_id": "'"$WORKSPACE_ID"'",
    "status": "draft",
    "content": [{ "text": "v1.4.0: you can now roll back any migration with one command." }],
    "accounts": ["'"$X_ACCOUNT_ID"'", "'"$LINKEDIN_ACCOUNT_ID"'"]
  }'

What each part does:

  • X-API-Key is a key you create in the dashboard. Give your CI key only the scope it needs to create posts, and not the separate publish scope. Then even a misconfigured job cannot push anything live.
  • Idempotency-Key makes retries safe. If CI reruns the job with the same key, you get the same post, not two drafts. Using the release tag as the key is a simple choice.
  • status: "draft" is the default, but write it anyway so the intent is obvious to whoever reads the workflow next.
  • content is an array of blocks. Several blocks become a thread on networks that support threads.
  • accounts lists the connected accounts to draft for. You can find your workspace and account ids through the API's list endpoints (GET /v1/workspaces and GET /v1/accounts).

In a GitHub Actions workflow that runs when a release is published, the job can build the request body from the release itself. A sketch, using jq to keep the JSON safe:

on:
  release:
    types: [published]

jobs:
  draft-post:
    runs-on: ubuntu-latest
    steps:
      - name: Create draft post from release
        env:
          API_URL: ${{ secrets.SOCIAL_API_URL }}
          API_KEY: ${{ secrets.SOCIAL_API_KEY }}
          WORKSPACE_ID: ${{ secrets.SOCIAL_WORKSPACE_ID }}
          ACCOUNTS: ${{ secrets.SOCIAL_ACCOUNT_IDS }}   # JSON array of ids
          TAG: ${{ github.event.release.tag_name }}
          URL: ${{ github.event.release.html_url }}
          NAME: ${{ github.event.release.name }}
        run: |
          BODY=$(jq -n \
            --arg ws "$WORKSPACE_ID" \
            --argjson accounts "$ACCOUNTS" \
            --arg text "$NAME is out. What changed and how to upgrade: $URL" \
            '{workspace_id: $ws, status: "draft", accounts: $accounts,
              content: [{text: $text}]}')
          curl -sf -X POST "$API_URL/v1/posts" \
            -H "X-API-Key: $API_KEY" \
            -H "Content-Type: application/json" \
            -H "Idempotency-Key: release-$TAG" \
            -d "$BODY"

Notice the draft text is deliberately plain: the release name and a link. That is on purpose. CI is good at facts and bad at first lines. You open the draft, rewrite the first line using lesson 5, check the preview per network, and approve it.

If you would rather write it in TypeScript (for example in a release script you already run), the same call with fetch looks like this:

const res = await fetch(`${process.env.API_URL}/v1/posts`, {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.API_KEY!,
    'Content-Type': 'application/json',
    'Idempotency-Key': `release-${tag}`,
  },
  body: JSON.stringify({
    workspace_id: process.env.WORKSPACE_ID,
    status: 'draft',
    accounts: accountIds,
    content: [{ text: `${name} is out. What changed: ${releaseUrl}` }],
  }),
});
if (!res.ok) throw new Error(`Draft failed: ${res.status}`);

We also publish official SDKs, a CLI for scripts and CI, and a live OpenAPI spec; see the SDKs page if you prefer typed calls over raw requests.

Option 2: let your coding agent draft

If you already work with a coding agent, it can be your posting assistant too. Connected through an MCP server, the agent can read your workspace, draft posts per network, and propose a schedule. You review in the chat or the dashboard.

What this looks like day to day:

  • After merging a feature: "Draft a post for X and LinkedIn about the PR we just merged. Lead with what users can do now."
  • On Monday: "Look at this week's closed issues and the changelog, and draft four posts for my slots: a release, a decision, a lesson and a fix."
  • After a postmortem: "Draft a short, blameless summary of the incident write-up in docs/incidents. No hostnames or internal details."

The agent already has the context: it read the diff, the issue and the docs while you worked. The approval rule still holds: an agent connected to our MCP server drafts and proposes, and anything that would publish or schedule waits for your OK. The list of supported clients and how to connect each one is on our agents page.

Give your agent the same rules you would give a new teammate. Paste your positioning line from lesson 1, your never-share list from lesson 4 and the first-line checklist from lesson 5 into your project's agent instructions. The drafts get noticeably closer to what you would write.

Close the loop with webhooks

Automation should also tell you when something goes wrong. Our API can send webhooks for post and delivery events, such as delivery.published when one account's post goes live and delivery.failed when one will not publish. A small handler can post a message in your team chat, or open an issue when a delivery fails, so a failed announcement does not go unnoticed for a week. The events and payloads are documented on the webhooks API page.

Worked example: one of our own releases

Here is how the split between automation and judgment plays out on a real release of ours: listing our MCP server in the directories coding agents use to find servers. The release lives in our public changelog, and the drafts are aimed at our X, LinkedIn, Bluesky and Discord accounts.

A draft generated from the changelog line alone, the way a CI job or a workflow would produce it, reads roughly like this:

MCP server now listed in agent directories. Details: [link]

Accurate, and nobody stops for it. It describes what we did, not what the reader can do. The version worth approving for X:

You can now find us in the directories your coding agent
already uses. Add the server, sign in in the browser,
and ask your agent to draft your week. Nothing publishes
until you approve it.

And for Discord, where people who already use the product read:

Our MCP server is now listed in agent directories, so you
can add it from your client's own list instead of pasting
a URL. Same sign-in, same approval step. Questions welcome
in this channel.

The automation does the boring part: noticing the release, creating a draft for each account, filling in the link. The human part is the first line, the reader's point of view and the "nothing publishes" reassurance our audience cares about. That split is the whole lesson: code for facts, people for judgment.

Recap

  • Automate noticing, drafting, tagging and scheduling. Keep judgment and approval human.
  • Create drafts from CI with a key that cannot publish, and an idempotency key so retries are safe.
  • Your coding agent can draft posts through MCP; it proposes, you approve.
  • Use webhooks so failed deliveries reach you instead of hiding.

Exercise

Build a dry-run release post script

  1. Write a small script (shell or TypeScript) that reads your latest release: its name, its notes and its URL. If you use GitHub, the free GitHub CLI can print it with gh release view --json name,tagName,body,url.
  2. Have the script turn the first user-facing line of the notes into a post: release name, one benefit sentence, the link. Print it to the terminal instead of sending it anywhere.
  3. Paste the output into the free X character counter and adjust the script until the post fits with room to spare.
  4. Add a --dry-run flag that is on by default, so nothing can ever be sent until you deliberately build that part.
  5. Done looks like: a script in your repo that prints a ready-to-review post for your latest release, with a comment marking where a draft-creating API call would go later.

Go further

API keys and webhooks in FoPost

When your dry run looks right, swap the print for a draft-creating call. Create a key in API keys with the posts scope and without the publish scope, store it as a CI secret, and add a webhook for failed deliveries. See the API page for keys, SDKs, the MCP server and webhooks in one place.

Check yourself

  1. 1Why should CI create drafts instead of publishing directly?

    A draft lets a person catch a broken release, a security-sensitive fix or a weak first line before it goes live, for the cost of one click.

  2. 2What does an idempotency key protect against?

    Duplicate posts when a job retries; the same key returns the same post instead of creating another.

  3. 3What should you give your coding agent before asking it to draft posts?

    Your positioning line, your never-share list and your first-line checklist, the same rules you would give a new teammate.

Academy

Keep reading, free

Tell us a little about you and the rest of this lesson, and every lesson in every course, opens on this device. No account and no card.

What describes you best?
Where do you post today? Pick any that apply.
What do you want most right now?

We use your answers to suggest lessons and to improve the Academy. They are never shown publicly. Read our Privacy Policy.