← Back to blog

Auto Reply to YouTube Comments With AI: A Nightly Digest Claude Code Writes While You Sleep

·auto reply youtube comments AIClaude Code scheduled taskscomment managementX repliesAI agent

Auto Reply to YouTube Comments With AI: A Nightly Digest Claude Code Writes While You Sleep

Replying to comments is the part of posting that never ends. The video goes out in five minutes; the comments keep arriving for a week. Skip them and viewers who asked a real question leave with no answer. Answer them all by hand and an hour of every evening disappears.

The middle path is a digest. Every night, Claude Code reads what came in, drafts an answer to each question, and writes everything into one file. In the morning you read it with a coffee, fix what you like, and say which replies to send. You still make the calls. You just stop doing the sorting.

By the end of this recipe you’ll have:

Setup takes about 20 minutes, most of it signing in to your accounts.

Who this fits: a creator with a YouTube channel and/or an X account who gets more comments than they can comfortably answer, and a computer that is on at 9 pm. Local scheduled tasks only fire while the Claude Desktop app is open and the computer is awake, per Anthropic’s docs.

What it can and can’t do

I checked this against the PublishPort command set (publishport-opencli 1.0.40) so you don’t plan around something that isn’t there:

Platform Read Reply
YouTube Comments on a video (up to 100 per video), and your channel’s recent videos No reply command. You paste the approved answers in YouTube Studio
X Your notifications (replies, likes, follows), newest first Yes, replies to a specific post by its URL, text only or with an image

So the YouTube half of this recipe is a drafting assistant, and the X half can also send. That’s a deliberate fit with the digest idea: a person reads before anything goes out. Both platforms also have their own rules on automated replies, and a stream of copy-pasted answers reads as spam to viewers anyway, so keep a human approval in the loop. The auto-reply rules by platform are worth a read first.

The recipe

You’ll paste this into Claude Code in step 2. Replace @YOURHANDLE with your channel handle:

Read https://www.publishport.app/skill.md and follow it to set up PublishPort for me, then check that YouTube and X are connected, read the newest comments on my 3 latest YouTube videos (my channel is @YOURHANDLE) and my recent X notifications, write draft replies to every question into a file called digest-today.md in this folder, and don't post anything; after that, help me turn it into a daily 9 pm 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, run commands, and verify results. Authorization is one click from you. Every AI you authorize is listed under AI access on your account page, where you can revoke it any time.

Step 0: Get three things ready

1. The PublishPort desktop app, signed in to YouTube and X. Install it from the download page, open Platform accounts, click Sign in next to each platform, sign in the way you normally do in the window that opens, then click I’ve signed in (walkthrough). The AI reads your comments through those sessions, the same view you’d have in your own browser.

2. Claude Desktop with the Code tab. Local scheduled tasks need Claude Desktop 1.1.5368 or later (docs). You’ll also need Node.js for the publishing command; check with node -v or install the LTS release from nodejs.org.

3. A folder for the digest. Create an empty folder, say comment-desk, with one file in it called seen.md (empty is fine). Optionally add voice.md: three or four sentences on how you talk to your audience (“friendly, short, never salesy, I say ‘thanks for watching’ not ‘thanks for the support’”). The drafts will sound much more like you with it.

Step 1: Open the folder in Claude Code

In the Claude Desktop Code tab, start a session in the comment-desk folder. Trust the folder when asked.

Step 2: Paste the recipe and approve once

Send 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 whether YouTube and X are signed in. If one is missing, sign in again under Platform accounts and ask it to re-check.
  3. It lists your three latest videos, reads their newest comments, reads your X notifications, and writes digest-today.md. Open it and judge the drafts. If they’re too long or too eager, tell it (“shorter, no emojis, never promise a future video”) and ask it to save that into voice.md.
  4. Nothing was posted. That’s the point of this first run.

Claude will ask permission for a few commands. Approve them while you’re watching; step 3 turns that into a standing approval.

Step 3: Turn it into a nightly task

Ask Claude in the same session to create the task, or do it by hand: in the Code tab click Scheduled, then New task. If a menu offers Create with Claude or Set up manually, either works. For the manual route, expand Advanced settings and switch on Only on this computer, pick your comment-desk folder, choose Daily and 9 pm in the Trigger card, and paste this as the instructions:

This is a pre-approved nightly digest. It is read-only: do not post, reply, like or follow anything.

1. Using PublishPort, read the comments on my 3 most recent YouTube videos (channel @YOURHANDLE) and my recent X notifications.
2. Skip anything already listed in seen.md. Comments have no id, so match on the author name plus the first 60 characters of the text. Skip comments I've already replied to if it's visible.
3. Write digest-YYYY-MM-DD.md (today's date) with: first, a one-line count per platform; then a numbered list. Each item: where it came from (video title or post URL), the author, the comment, and a draft reply in my voice (see voice.md). Questions get a real answer; praise gets a short thanks; anything rude, spammy or about money, legal or health gets "no reply suggested" and a reason.
4. Never invent facts about my videos or products. If you don't know the answer, write "needs you" instead of guessing.
5. Append every item you listed to seen.md, then stop.

Create the task, then click Run now on its page and watch for permission prompts. Anthropic’s docs recommend this: select “always allow” for each prompt, and future runs of that task auto-approve the same tools. Without that step, a nightly run that needs a permission will sit waiting until you answer.

Two things to know. If the computer sleeps through 9 pm, the run is skipped; when it wakes, Desktop starts one catch-up run for the most recent missed time. You can turn on Keep computer awake in Settings > This computer > System to prevent idle sleep. And each run starts a fresh session, so seen.md and voice.md are the AI’s only memory. That’s why they exist.

Step 4: The morning routine

Open digest-<today>.md. Edit any draft you like. Then open a Claude Code session in the same folder and tell it which ones to send:

Send X replies 1, 3 and 4 from today's digest exactly as written. Show me the final text of each first.

Because you’re in the room, PublishPort’s “show the user before the first post of a session” step is satisfied naturally, and the AI posts, then confirms each reply exists. For YouTube items, copy the draft into the comment box in YouTube Studio. It takes a minute and it’s the part with no command.

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.