Lecture Guide

Cusdis Automation Overview

Build an end-to-end comment moderation flow with n8n, Gemini, and Cusdis.

A practical beginner-friendly course for automating blog comment operations, covering the whole loop from webhook wiring and n8n triggers to Gemini classification, conditional routing, approval APIs, and operations checklists. It also emphasizes input contracts and failure handling, which are often the hardest parts for beginners.

This course follows the full path from incoming comment event to webhook delivery, n8n workflow trigger, Gemini classification, and final approval or reply. The core lesson is not just how to use the nodes, but how to make the input contract and operating behavior reliable.

The most common failures in AI automation do not come from model setup alone. They come from unstable output formats and unclear operating rules. That is why the course treats JSON contracts, normalization code, branching logic, delay handling, and fallback operations as one connected topic.

By the end, you should not only have a workable moderation flow, but also a better sense of where human intervention is still necessary and where automation can be trusted.

Deliverable: a production-minded workflow that analyzes, delays, approves, and replies to safe comments automatically, plus a JSON moderation contract, normalization code, approval request examples, and rollout checklists.

Difficulty
Beginner to early intermediate
Estimated time
About 1h 40m
Format
13-slide deck

Who this is for

  • Solo builders or developers who currently moderate comments manually and need a first automation project.
  • Beginners who want to learn n8n, webhooks, APIs, and JSON through a concrete workflow.
  • Learners who want to use AI as a decision engine inside operational automation rather than just a chatbot.

Prerequisites

  • Basic familiarity with HTTP requests and JSON is enough.
  • Having either an n8n Cloud account or a self-hosted n8n instance makes practice easier.
  • Access to a Cusdis site settings screen helps you follow the workflow end to end.
  • It helps if you are ready to treat AI output as unreliable by default and learn how to enforce a stricter output contract.

What you will be able to do

  • Wire Cusdis webhooks into n8n so comment events become the trigger for automation.
  • Design prompts that force Gemini into a JSON contract and post-process the output safely.
  • Combine clean-comment branching, random delay, and approval API calls into one workflow.
  • Prepare a deployment checklist and identify recovery points needed for live operations.

Tools

  • Cusdis
  • n8n Cloud or self-hosted n8n
  • Gemini API
  • Cloudflare Tunnel when self-hosting

Recommended study path

  • If this is your first pass, read the Lecture Guide, open the example README to see the end state, then move into the slide deck.
  • Keep the webhook sample and JSON contract beside you while practicing; they anchor the whole flow.
  • At first, focus on stabilizing the incoming payload and branching rules rather than chasing a fully polished auto-approval flow.

Chapter guide

01

Setup and understand the full flow

Clarify the roles of Cusdis, n8n, and Cloudflare Tunnel before touching the workflow details. Once those boundaries are visible, the later node-level setup becomes much easier to reason about.

When building your first automation, the real confusion does not come from having many tools. It comes from not knowing what each tool is responsible for. Cusdis emits the comment event, n8n executes the workflow, and Cloudflare Tunnel exposes a public route when you self-host the workflow engine.

This chapter is about building the end-to-end map first. You need to understand where the signal travels, when the AI becomes part of the flow, and where the final approval request happens before the node-level work becomes manageable. Without that map, more detailed settings usually create more confusion, not less.

The chapter also explains the difference between n8n Cloud and self-hosted setups. For beginners, n8n Cloud is usually the faster starting point. Self-hosting offers more control, but that control comes with responsibility for public access, updates, security patches, and operations.

What each tool owns in the automation flow
ToolPrimary roleWhat breaks without it
CusdisEmits the comment event and provides the source dataThe automation never receives the source event
n8nReceives the event and runs branching plus follow-up actionsClassification, delay, and approval steps never connect
Cloudflare TunnelExposes a self-hosted n8n instance through a reachable HTTPS routeExternal webhooks cannot reach a local or private instance
You will learn
  • Why Cusdis is a strong first automation target
  • A realistic decision rule for n8n Cloud vs self-hosted
  • Why you need a public URL before incoming webhooks can work
Key artifacts

End-to-end system flow and workflow image

Diagram

Shows the full path from Cusdis event to n8n, AI classification, and the final approval request.

Self-hosted public URL checklist

Checklist

A short checklist for exposing a self-hosted n8n instance through an HTTPS URL that can receive webhooks.

02

Create the webhook trigger

Connect Cusdis comment events to the first Webhook node in n8n. This chapter reinforces the rule that the incoming payload is the first thing you must understand in any automation flow.

In automation work, the input payload is your first system contract. If you do not know which fields exist, where the site ID lives, or how the author and body are represented, the later AI and approval steps will keep drifting. That is why this chapter puts more emphasis on reading the payload than on clicking through setup screens.

Registering the webhook URL in Cusdis Site settings is not just a configuration step. It opens a contract between the comment system and the automation engine. The n8n Webhook node becomes the first receiver on that contract. That is why you should test with at least one normal comment and one spam-like comment early.

Once this chapter is clear, the later steps become much simpler. AI classification, branching, and approval all depend on the input shape defined here. If the input contract is unstable, every later node becomes unstable too.

What to verify first at the webhook stage
CheckpointWhy it mattersWhat it affects downstream
Site identifierYou must know which site the comment belongs toLinks the approval API to the correct target and credentials
Comment body and metadataFeeds AI classification and reply draftingAffects model quality and normalization logic
HTTPS reachabilityExternal webhooks must actually reach the endpointDetermines whether the workflow starts at all
You will learn
  • Connect the webhook URL from Cusdis site settings
  • Read the input shape of the n8n Webhook node
Key artifacts

sample-comment-webhook.json input example

JSON example

Shows the real field structure of a comment event emitted by Cusdis. Every downstream AI and approval step depends on this input shape.

03

Gemini analysis and JS normalization

Force the AI into a strict JSON contract and normalize it with defensive JavaScript. The focus is less on connecting the model and more on turning model output into machine-consumable data.

The most dangerous moment in AI automation is when the model replies with plausible natural language and the workflow continues anyway. Humans may tolerate that ambiguity, but machines need a stable JSON contract. This chapter explains why classification, reason, and reply draft must always return in the same shape.

The prompt must behave more like a contract than a casual request. You need to say which fields are required, which values are allowed, how long the output may be, and what to return when confidence is low. That lets the model fall back to a REVIEW state instead of pretending certainty when it should not.

Even that contract is not enough on its own. In production, model output can still be malformed or partially missing. That is why defensive JavaScript is required to absorb parsing failures and assign safe defaults. The course treats that normalization layer as mandatory, not optional.

An example Gemini JSON contract
FieldAllowed values / shapeWhy it is needed
classificationNORMAL / SPAM / REVIEWLets the branch node decide the next step safely
reasonShort explanation stringGives operators a traceable reason for the decision
replyDraftShort, natural reply draftProvides output that can be used directly in the approval step
You will learn
  • How to shape a Gemini prompt like a JSON schema
  • How to avoid a broken workflow when AI output is malformed
Key artifacts

gemini-moderation-prompt(.md) JSON contract template

Prompt

Defines how the model should return classification, reason, and replyDraft under a strict JSON contract.

normalize-gemini-output.js normalization example

Source

A defensive normalization example that absorbs malformed model output and applies safe defaults.

04

Conditional routing and approval API

Route only safe comments forward, wait for a natural delay, then send approval and reply requests. This is the chapter where speed, safety, and human-like operating rhythm meet in one workflow.

For automation to feel production-ready, two things must happen together: only the right comments move forward, and the flow should not behave in a visibly robotic way. The If node is the primary safety gate here. Only NORMAL comments continue, while SPAM and REVIEW can be routed elsewhere.

The Wait node is not just cosmetic. If a reply appears instantly after a comment arrives, the system can feel robotic to users and overly aggressive to operators. A short random delay may look minor technically, but it changes the perceived moderation rhythm in a meaningful way.

Finally, the HTTP Request node is where the workflow stops reasoning and starts acting. The approval payload and reply body must be shaped correctly, pointed at the right site, and backed by the correct credentials. Because this is the transition from decision to action, it is the most sensitive point in the system.

Flow-control stages before the approval request
StageWhat it doesOperational meaning
IfLets only NORMAL comments move forwardActs as the primary safety gate against unsafe approval
WaitAdds a randomized delay before the reply is sentReduces robotic timing and softens the operating rhythm
HTTP RequestSends the approval and reply request to the live APITurns workflow judgment into real service behavior
You will learn
  • Use the If node to pass only NORMAL comments
  • Create a human-like moderation rhythm with the Wait node
  • Call the approval/reply API through the HTTP Request node
Key artifacts

approve-comment-request.json approval request example

API example

Shows the exact approval request body, including how the site identity and replyDraft are packaged for the API call.

Random-delay expression and deployment checklist

Checklist

Pairs the random-delay idea used in the Wait node with the rollout checks you should complete before activating the workflow.

05

Ops review and extension ideas

Review the failure points, rollout checks, and next automation ideas needed for production. The closing emphasis is not just on finishing the workflow, but on operating it safely.

Automation does not end once it works one time. In a real environment, you must expect false positives, false negatives, expired credentials, webhook failures, malformed model output, and broken API calls. That is why the final chapter focuses less on making the workflow more impressive and more on making it survivable.

From the operator’s perspective, fallback is the most important concept. Can you turn the workflow off and return to manual moderation? Do you collect parsing failures separately? Will a human inspect the first few approvals by hand? These questions are just as important as the automation logic itself.

Extensions grow out of this stable base. Slack alerts, comment archives, moderation reports, and dashboards all sound attractive, but they only matter once the core loop is safe and understandable. The course introduces those as next moves, not as day-one requirements.

Common production risks and the right first response
RiskFirst place to inspectRecommended fallback
Gemini output parse failureCode node logs and raw model outputRoute to REVIEW or fall back to manual approval
Approval API call failureHTTP Request response codes and credentialsPause the workflow and handle comments manually
Rise in false positives or false negativesClassification samples and the prompt contractIncrease REVIEW routing until the prompt is tuned
You will learn
  • Where to debug first when the workflow fails
  • How to extend the flow into Slack alerts, archival, or moderation reports
Key artifacts

ops-checklist(.md) operations checklist and fallback memo

Ops note

Documents pre/post-rollout checks plus fallback procedures such as parse-failure handling and manual moderation rollback.

Hands-on evidence

Full workflow structure

See the moderation flow from comment event to final approval request.

Full workflow structure

Gemini node setup

A concrete example of configuring AI as a structured moderation step, not a vague chat call.

Gemini node setup

Approval API request

Inspect the request shape used in the final production-facing step.

Approval API request

JSON contract example

This is the minimum response contract the AI is asked to produce.

{
  "classification": "NORMAL | SPAM | REVIEW",
  "reason": "short explanation",
  "replyDraft": "human-sounding reply draft"
}

Practice assets

Example README

Document

Start here for the practice flow and a quick map of the example files.

Webhook payload sample

JSON

Inspect the incoming comment event shape sent by Cusdis.

Gemini prompt contract

Prompt

A prompt template that forces structured JSON output.

JS normalization code

Source

A defensive parsing example that absorbs malformed AI responses.

Approval request body

API example

An example request body for comment approval and reply posting.

Ops checklist

Checklist

A deployment-time checklist for stable operations.

FAQ

Can I follow this without being strong in code yet?

Yes. The main goal is to see webhooks, JSON, and branching in a real flow. The JavaScript examples stay short and purpose-driven, so beginners can focus on the structure rather than language complexity.

Can I practice without n8n Cloud?

Yes. A self-hosted n8n instance plus Cloudflare Tunnel is enough to reproduce the full workflow, and the course covers that path. It also explains why Cloud is faster to start with while self-hosting shifts more responsibility to you.

Is auto-approval too risky?

That is exactly why the course includes JSON contracts, branching rules, random delay, and an ops checklist. The goal is not blind approval, but a moderation loop that filters aggressively and still leaves you a manual fallback path.

맞춤형 분석 동의

이 사이트는 방문 분석을 위해 Google Analytics를 사용합니다. 동의하시면 익명화된 페이지 이동 정보만 수집합니다. (기록 보존: 2026)