← Back to blog

Automatic Posting to Social Media with Claude Code: A Daily Scheduled Task That Works With Your Laptop Closed

·automatic posting to social media claudeClaude Code scheduled tasksauto post to Xsocial media automationAI agent

Automatic Posting to Social Media with Claude Code: A Daily Scheduled Task That Works With Your Laptop Closed

Most people who want an AI to post for them end up with two half-answers. Either the AI drafts the post and you still paste it into four apps, or the AI runs on your laptop and everything stops when you close the lid.

Claude Code’s scheduled tasks fix the second problem: they run on Anthropic’s cloud, so they fire whether or not your computer is awake. What a cloud session can’t do on its own is post from your accounts, because it isn’t on your computer. PublishPort is the missing link: the cloud session sends its publishing commands through the PublishPort relay, and they run on the computer where you’re already signed in to X, Bluesky, Threads and LinkedIn.

By the end of this recipe you’ll have:

It takes about 20 minutes, most of it spent signing in to your accounts and filling in one environment form.

Who this fits: someone with a Claude plan that includes scheduled tasks (Pro, Max, Team or Enterprise, currently a research preview per Anthropic’s docs) and a home or office computer that is switched on at posting time. The AI lives in the cloud; the posting happens on that computer, so it still needs to be on, with the PublishPort app running.

The recipe

You’ll paste this to Claude Code in step 3:

Read https://www.publishport.app/skill.md and follow it to set up PublishPort for me, then check which of my accounts are connected, and write today's post for X, Bluesky, Threads and LinkedIn from the line dated today in topics.md in this repo; show me each version, and once I approve, publish them and give me the links. After that, help me turn it into a daily scheduled task.

The skill file is a short public instruction sheet. It tells the AI how to sign in, see which accounts your computer has connected, publish, and confirm the post is live. Authorization is one click from you; every AI you’ve authorized is listed under AI access on your account page, where you can revoke it at any time.

Step 0: Get three things ready

1. The PublishPort desktop app, signed in to your platforms. Install it from the download page, open Platform accounts, click Sign in next to X, Bluesky, Threads and LinkedIn, sign in the way you normally would in the window that opens, then click I’ve signed in (walkthrough). Posts then come from your real sessions, exactly like ones you’d type by hand.

2. Claude Code. Any of the surfaces works for the first run: the CLI in a terminal, the desktop app, or claude.ai/code. You’ll also need Node.js on the machine where you run the test post. Check with node -v, or install the LTS release from nodejs.org.

3. A GitHub repo with a topic calendar. Scheduled tasks are built around repositories: each run clones the ones you select. Create a private repo (for example my-posting) with one file, topics.md:

2026-10-21: Why I stopped batching content on Sundays
2026-10-22: A mistake in my onboarding email and what it cost
2026-10-23: The one spreadsheet I check every Monday

One dated line per day, a week or two ahead. Each line is just a seed (a topic, an angle, a link); Claude writes the actual post. Using the date as the key means the task needs no memory of what it posted yesterday, which matters because every run starts from a fresh clone.

Step 1: Pick the platforms and know their limits

What you ask for has to exist, so here is what the publishing tools do today (checked against the PublishPort command set, publishport-opencli 1.0.40):

Platform What the task can do Limit worth putting in the prompt
X Post text with up to 4 images Keep it within X’s character limit
Bluesky Post text with up to 4 images 300 characters
Threads Post text with one image Short and conversational
LinkedIn Post text with images Up to 3,000 characters; the command only publishes when sent with --send true, and dry-runs otherwise

Different lengths are why the recipe asks for a separate version per platform instead of pasting one text everywhere.

Step 2: Do a supervised first run

Open a Claude Code session in a clone of your repo and paste the recipe. What happens:

  1. Claude reads the skill, installs it, and runs the login. It gives you an authorization link and a confirmation code. Open the link, sign in or create a PublishPort account, check the code matches, click Authorize. The link lasts 10 minutes; ask for a new one if it expires.
  2. It checks your computer and reports which of your four accounts are signed in. If one is missing, sign in again under Platform accounts and ask it to re-check.
  3. It finds today’s line, writes four versions, and shows them to you. Edit as you like (“less salesy on LinkedIn”), then say “post it”.
  4. It publishes one platform at a time and checks each post exists before handing you the link.

Do this by hand at least once. Claude Code’s instructions from PublishPort say to show a person the content before the first post in a session, so this is the run where you tune the voice, and the notes you give become the rules in your scheduled prompt.

Step 3: Give the cloud session its credential

The login in step 2 saved your credential on the machine where you ran it (~/.publishport/config.json). A cloud run starts on a fresh machine and will never see that file. PublishPort’s instructions for throwaway sandboxes say to pass the credential through the environment instead. In Claude Code that means a cloud environment, the settings bundle a scheduled task runs in (Anthropic docs).

  1. In the PublishPort app, open the Connect AI page, expand Use MCP instead, and click Generate address. The address contains your credential.

  2. At claude.ai/code, create a new environment (or edit the one you’ll use for this task) and add one line under environment variables, in KEY=value form:

    PUBLISHPORT_MCP_URL=<the address you copied>
  3. Set the environment’s Network access to Custom with the defaults included, and add api.publishport.app under Allowed domains. The default Trusted level only reaches an allowlist of package registries and developer sites, so without this line the publish call is blocked (network access docs).

Two cautions, both from the same docs. Environment variables are visible to anyone who can use that environment, so make a separate environment for this task and don’t share it. And the address can run commands on your computer: treat it like a password, never commit it to the repo, and if it leaks, revoke the AI under AI access on your account page and generate a new one.

Step 4: Create the scheduled task

Go to claude.ai/code/routines and click New task. (If a menu opens first, choose Set up manually; Create with Claude also works if you’d rather describe it in a chat. From the CLI, /schedule daily post at 8am starts the same flow.) Fill in:

This is a pre-approved daily publishing task. Publish without asking me to confirm.

1. Open topics.md and find the line dated today. If there isn't one, stop and say so.
2. Write one post per platform from that line: X (within its character limit), Bluesky (300 characters or fewer), Threads (short, conversational), LinkedIn (a few short paragraphs, no hashtag stuffing). Same idea, different phrasing for each. No invented statistics or quotes.
3. Publish through PublishPort, one platform at a time: X, Bluesky, Threads, LinkedIn. Use publishport guide <platform> to check the live command options before each. For LinkedIn the publish flag must be set explicitly.
4. If a platform errors or times out, don't re-run the command. Check that platform's recent posts first and retry once only if the post isn't there. If it still fails, skip it and say why.
5. End with a summary: platform, the text, and the link, for each post.

Nobody is watching at 8 am, so the prompt spells out what is pre-approved. Be aware of one limit: Anthropic’s docs say a saved prompt is the task’s assignment but is not live user input and can’t act as consent for actions during the run. If Claude holds back on the first scheduled runs and says it needs your confirmation, that’s its safeguard working. Watch the first few sessions, and tighten the wording or the topic file rather than trying to argue it out of the check. Also note that scheduled tasks run without stopping for permission approvals and use every connector you leave switched on, so on the Connectors tab remove any the task doesn’t need.

Click Create, then Run now on the task’s page for an immediate test. Each run is its own session you can open and read.

When it won’t run

Make it yours

The free plan covers setting all of this up; plan limits and pricing are on the pricing page.