← Back to blog

Post Every New YouTube Video to X, Bluesky and Mastodon Automatically

·post to X and Blueskycross-post to MastodonCodex scheduled tasksYouTube promotionsocial media automation

Post Every New YouTube Video to X, Bluesky and Mastodon Automatically

A video goes live. You post the link once, watch the first hour of comments, and get back to editing. By the next morning the video is old news on every network except YouTube, where people are still finding it.

One video, three composers. By the third paste the caption is shorter, the hashtags are wrong, and the last network gets whatever is left. Doing that per upload is the part that gets skipped.

This recipe gives that job to Codex. A scheduled task checks your channel every morning. When there is a new video, it writes one post per network and publishes all three through the accounts already signed in on your computer. When there is no new video, it does nothing.

A one-line log keeps the task from posting the same video twice, and you can copy that pattern into any other scheduler.

This is for people who already publish videos on YouTube and want the announcement handled without opening three more tabs. It posts text and the video link; it does not make a native clip for each network, and it does not answer comments for you.

The trade-off: two desktop apps stay running, and the computer has to be awake at 9:00. In exchange, you never create a developer app for X, Bluesky or Mastodon, and the posts leave from sessions that are already logged in. The one rules file edit is written by Codex from the prompt in Step 1. If you will be away at 9:00, run the task before you leave; the log stops it from posting twice. If you publish once a month, the setup is more work than the three posts; at roughly two or more videos a week, it pays for itself.

By the end you will have a video-promo folder with a youtube-posts.md log, a daily 9:00 task under Scheduled, and one video that went out to all three networks while you watched.

Give it 15 minutes once the apps are installed; the rules step is the only part that can trip you up, and it has a copy-paste path.

What changes on each network

The limits are the visible difference. The culture decides whether the post reads as native.

Network Limit What the post should do
X 280 characters on the standard composer; longer posts are an X Premium feature (X help) Open with the sharpest claim or number from the video. Put the link after it, and keep hashtags to one at most.
Bluesky 300 graphemes, four images at up to 1 MB each (Bluesky docs, post lexicon) Give the question the video answers, or the context that makes the link worth opening. Conversational, no hashtag wall.
Mastodon 500 characters by default; your server can change it (Mastodon docs) Write it the way you would tell a friend what is in the video, then add the link. Content warnings are normal here if the topic needs one.

That is why the recipe asks for three versions instead of one paragraph pasted three times. The AI has the video’s title and description, which is enough to find a different angle for each one. If you want more control, add a line to the task prompt such as “X: the result, Bluesky: the question, Mastodon: the method.”

This recipe posts text and the link. Attaching the thumbnail is a separate step with its own size limits, and it is not needed for the first version to work.

The recipe

The sentence below does four things in order: it installs the publishing skill and authorizes PublishPort, reads your channel, drafts three posts and waits for your approval, then creates the 9:00 task. Keep it as one paragraph so you can paste it in one go. Replace the channel URL and the Mastodon server with your own.

Read https://www.publishport.app/skill.md and follow it to set up PublishPort for me, then check that X, Bluesky and Mastodon (my account is on mastodon.social) are connected; read my YouTube channel https://www.youtube.com/@yourhandle with PublishPort's YouTube commands, pick the newest public video by publish date, and read its description; write three different posts (X: 280 characters or fewer, Bluesky: 300 or fewer, Mastodon: 500 or fewer), show me the exact text, and after I approve publish all three, verify each link, and record the video ID and links in youtube-posts.md; then create a Codex scheduled task that runs daily at 9:00, checks for a video newer than the last one in youtube-posts.md, publishes it to all three without asking, and does nothing when there is no new video.

The skill file is a short public instruction sheet. It tells the AI how to sign in, check which accounts are connected, publish, and confirm the post exists. Every AI you authorize appears on your account page, where you can revoke it.

Step 0: Three things ready

1. The ChatGPT desktop app, with Codex. Install it from OpenAI’s download page and sign in. Scheduled tasks are managed in the desktop app or on the web; per OpenAI’s docs, the Codex CLI and IDE extension do not provide the Scheduled interface. Web tasks cannot work in a folder on your computer either, so use the desktop app.

2. The PublishPort desktop app, signed in to X, Bluesky and Mastodon. Install it from the download page, open Platform accounts, and sign in to each network in the window that opens (walkthrough). For Mastodon, give the app the address of your server, not just mastodon.com; there is no single Mastodon site. The recipe above assumes mastodon.social, so change that line if your account lives elsewhere.

You do not create developer apps, API keys or OAuth clients for any of the three networks. PublishPort publishes through the browser sessions you already use, which is also why the computer has to be on when the task runs. You do not need to connect YouTube either: the channel read uses public channel data, and the three accounts above are the only ones you sign in to. At the time of writing, the free plan covers three platforms, which is what this recipe uses.

3. Your channel URL and at least one public video. The address looks like https://www.youtube.com/@yourhandle. The channel page only lists public uploads, so a private or unlisted video will not appear until it is public.

The publishing command runs on Node.js. You do not need to check it by hand: in Step 2, Codex runs node -v and tells you if the LTS install from nodejs.org is needed.

Step 1: Let the scheduled task reach the network

The step most people skip is the sandbox rule. Scheduled tasks run unattended with your default sandbox settings, and the default workspace-write sandbox blocks network access (OpenAI docs). Every publish needs the network, so a task that works in a supervised chat will fail at 9:00 without a rule.

OpenAI’s answer is rules: allow one command prefix to run outside the sandbox instead of opening everything up. You do not write the file by hand; send this to Codex:

Install the publishport CLI globally with npm, then add a rule to ~/.codex/rules/default.rules that allows commands starting with "publishport" to run outside the sandbox. Tell me when to restart the app.

Approve what it asks, then quit and reopen the ChatGPT desktop app so the rule loads. After the restart, ask Codex to run publishport capabilities. A device list or a login prompt means the command got through. A network error means the rule did not load; the manual version is at the end of this post.

Only commands that start with publishport run outside the sandbox; everything else stays restricted.

Step 2: Open a folder and paste the recipe

Create a folder called video-promo and open it in Codex as your workspace. It does not need to be a Git repository. In a non-version-controlled project, OpenAI’s docs say scheduled tasks run directly in the project directory, which is what we want: the log stays next to the task.

Paste the recipe sentence. Here is what happens next:

  1. Codex installs the PublishPort skill, so future chats already know how to publish.
  2. It runs the login command and gives you an authorization link and a confirmation code. Open the link, sign in or create a PublishPort account, check that the code matches, and click Authorize. The link is valid for 10 minutes; ask for a new one if it expires.
  3. It checks your computer and reports that X, Bluesky and Mastodon are ready.
  4. It reads your channel’s public upload list, picks the newest video by publish date, and looks up that video’s description.
  5. It writes three posts and shows you the exact text for each account.
  6. You reply “post it”. The three posts go out, Codex returns the links, and it writes the video ID and links to youtube-posts.md.

Codex may ask to run the skill installer or another setup command outside the sandbox. Approve it while you are watching; the scheduled run only needs the publishport rule.

Read the three drafts carefully. This is the one moment where you can set the voice for every future video. If the X version is too salesy, say so. If the Bluesky version repeats the title, ask for the question the video answers. If the Mastodon version reads like an ad, ask for the detail you would tell a friend. Codex can write those preferences into the task prompt in step 3.

The first run will promote your newest existing video, even if it is already old. That is the trial. It also writes that video to the log, so the scheduled task will not post it again.

The log is keyed by video ID, so a title change or a re-upload does not fool it. An empty file is safer than no file: the task can read an empty file and stop, but a missing file invites it to guess. One line per video is enough:

2026-11-06 | VIDEO_ID | https://x.com/you/status/... | https://bsky.app/profile/you.bsky.social/post/... | https://mastodon.social/@you/...

The log pattern works without PublishPort. If you already have a scheduler and a script, the part worth copying is the ID-keyed log: one line per video, check before posting, append after each success. That is what makes the run safe to repeat.

Step 3: Check the daily task

The recipe already asked Codex to create the task. Open Scheduled in the ChatGPT desktop app sidebar. You should see a daily 9:00 task attached to the video-promo project.

If it is not there, create a standalone task in Scheduled, choose the video-promo project, set it to daily at 9:00, and paste this prompt:

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

1. Read youtube-posts.md. It lists the YouTube video IDs already promoted and the links that went out. Create it if it is missing.
2. Read https://www.youtube.com/@yourhandle with PublishPort's YouTube commands. Take the few newest public videos, look up their publish dates, and pick the newest by date, not by the order on the page. Read its description.
3. If its video ID is already in youtube-posts.md, stop and reply "No new video since <date>".
4. Otherwise write three posts about it: X at 280 characters or fewer, Bluesky at 300 or fewer, Mastodon at 500 or fewer. Each one opens with a different specific detail from the video, includes the link, and avoids identical sentences and hashtag stuffing.
5. Check that X, Bluesky and Mastodon are signed in. If one is signed out, skip that platform and say so; don't stop the other two. Publish with the globally installed publishport command, not npx and not a full path. If one platform fails or times out, do not re-run it; check that account first and retry once only if the post is really absent. If it still fails, leave that platform out and say why.
6. Append the video ID, its publish date, and each link that went out to youtube-posts.md. Reply with a one-line summary.

A scheduled run starts cold from this saved prompt. PublishPort’s instructions tell an AI to show a person the content before its first post in a session; nobody is watching at 9:00, so the “pre-approved” line is what keeps it moving. OpenAI recommends testing a prompt by hand before scheduling it and reviewing the first few runs; step 2 was that test.

Step 4: Watch the first scheduled run

The morning after setup, open Scheduled and read the run. You want three things:

If you publish a video that afternoon and do not want to wait until tomorrow, open the task and choose Run now. Otherwise, change the schedule to a time that follows your usual upload slot.

If the run is missing, check the three conditions in the trade-off paragraph above before you blame the task.

Why the read and the post run on your machine

Reading a public channel and posting to three networks are separate problems. The read needs no API key: the channel page and each video page are public, and that is where the title, date and description come from. The publish needs a logged-in session on each network. Running both on your own machine is what lets the workflow use the sessions you already have, instead of creating a developer app for each network.

PublishPort is the bridge: its relay carries each command to the desktop app, which runs it with your sessions. The AI can be in a chat on your laptop or in the cloud; the commands still land on the machine where the desktop app is running. You never call the underlying platform commands yourself, and you do not paste an MCP address into anything. If your AI speaks MCP instead of the CLI, the same tools are exposed there; the setup sentence handles either.

If something doesn’t run

Nothing happened at 9:00. Check that the computer was awake, the ChatGPT desktop app was running, and the video-promo folder is still where you created it. Local scheduled tasks do not run on a sleeping machine.

The run reports a network error. The rule from step 1 is missing, the app was not restarted, or the task prompt uses npx instead of publishport. Fix the rule and edit the prompt.

A network is signed out, or one post is refused. Sessions expire; sign in again under Platform accounts in the PublishPort app. If Bluesky refuses the text, it is over 300 characters; ask Codex to shorten that version without dropping the link or the specific detail.

Codex says YouTube isn’t connected. It doesn’t need to be. Tell Codex to read the channel’s public upload feed instead: https://www.youtube.com/feeds/videos.xml?channel_id=UC..., fetched through PublishPort on your computer. Codex can pull the UC... ID from the channel page; the three publishing accounts are still the only ones you sign in to.

The same video appears twice. The log was not updated, or the task did not read it. Check youtube-posts.md and the first line of the task prompt. If the file is missing, the task should create it, but an empty file is safer than no file.

No new video is detected, or the copy is generic. The public listing can lag a few minutes behind a new upload, and a premiere or private video will not appear until it is public. For generic copy, give the task one concrete detail, such as the result, the disagreement, or the mistake the video covers.

If the install prompt fails

These are the same steps by hand. You do not need them if the prompt in Step 1 worked.

  1. Install the command:

    npm install -g publishport
  2. Open or create ~/.codex/rules/default.rules and add:

    prefix_rule(
        pattern = ["publishport"],
        decision = "allow",
        justification = "PublishPort publishing and channel reads need network access",
    )
  3. Restart the ChatGPT desktop app.

Then ask Codex to run publishport capabilities. A device list or a login prompt means the command got through; a network error means the rule did not load.

Variations

Where to take it next

Once the announcement is automatic, the next useful job is the follow-up: the replies on X, the comments under the video, the questions in your inbox. AI auto-replies to DMs and comments covers how to decide what the AI answers and what it hands back to you.

Upload the next video as usual. At 9:00, open youtube-posts.md and check the three links.