Bagaimana Cara Menghubungkan Telegram, AI, dan WordPress dalam Satu Alur n8n?

Inilah “jantung” sistem otomasi konten: menghubungkan Telegram (input), AI (otak), dan WordPress (output) dalam satu workflow n8n yang mulus. Banyak pemula bingung: “Node apa saja yang dipakai?”, “Credential gimana caranya?”, “Data flow seperti apa?”. Artikel ini menjawab dengan diagram alur, konfigurasi node per node, dan troubleshooting umum — sehingga Anda bisa replicate hari ini.

Arsitektur koneksi 3 pilar ini:

TELEGRAM (Trigger) n8n WORKFLOW AI MODEL WORDPRESS (Output)
┌─────────────┐ ┌──────────────────┐ ┌────────────┐ ┌──────────────────┐
│ User kirim │ ──── HTTPS ────▶ │ Telegram Trigger │ │ │ │ │
│ /artikel │ │ (Webhook/Long │ │ │ │ │
│ Judul SEO │ │ Polling) │ │ │ │ │
└─────────────┘ └────────┬─────────┘ │ │ │ │
│ │ │ │ │
▼ │ │ │ │
┌─────────────────────┐ │ │ │ │
│ Set Node: Normalize │ │ │ │ │
│ judul, slug, date │ │ │ │ │
└──────────┬──────────┘ │ │ │ │
│ │ │ │ │
┌────────────────────┼──────────────────┤ │ │ │
▼ ▼ ▼ ▼ ▼ │
┌─────────────┐ ┌───────────────┐ ┌────────────┐ ┌──────────┐ ┌──────────────┐ │
│ HTTP Request│ │ OpenAI/Anthro/│ │ Code Node │ │ HTTP Req │ │ HTTP Request │ │
│ SerpAPI │ │ Gemini Node │ │ Merge HTML │ │ WP Media │ │ WP Posts API │ │
│ (LSI KW) │ │ (Outline+Write)│ │ + FAQ Schema│ │(Image) │ │ (Publish) │ │
└─────────────┘ └───────────────┘ └────────────┘ └──────────┘ └──────────────┘ │
│ │ │ │ │ │
└────────────────────┴──────────────────┴────────────┴────────────┴────────────────┘
│
▼
┌─────────────────────┐
│ Telegram Send Msg │
│ (Notif Link Hasil) │
└─────────────────────┘

Setiap panah = data flow (JSON) antar node. n8n otomatis passing output node sebelumnya ke input node berikutnya via {{$json.field}} expression.

Persiapan Credentials (Wajib Sebelum Bangun Workflow)

Credential Type n8n Cara Dapatkan Test
WordPress REST API Header Auth WP Admin → Users → Profile → Application Passwords → “n8n-auto” → copy password curl -H “Authorization: Basic ” https://domain.com/wp-json/wp/v2/users/me
OpenAI API OpenAI API platform.openai.com → API Keys → Create new secret key n8n OpenAI node → Test → “Connection successful”
Anthropic (Claude) Anthropic API console.anthropic.com → API Keys → Create Key n8n Anthropic node → Test
Google Gemini Google PaLM API aistudio.google.com → Get API Key n8n HTTP Request ke generativelanguage.googleapis.com
Telegram Bot Telegram API @BotFather → /newbot → copy token → @userinfobot → dapat Chat ID n8n Telegram node → Test → “Connection successful”
SerpAPI (opsional) Header Auth / Query Auth serpapi.com → Dashboard → API Key Test query: serpapi.com/search.json?q=test&api_key=KEY

Tip: Simpan semua credential di n8n dengan nama deskriptif: WP App Password, OpenAI GPT-4o-mini, Claude 3.5 Haiku, Gemini 1.5 Flash, Bot Artikel Auto, SerpAPI Key. Nanti di node tinggal pilih dropdown.

Node 1: Telegram Trigger (Entry Point)

Dua mode utama:

Mode A: Webhook (Real-time, Direkomendasikan)

  • Node: Telegram Trigger
  • Credential: Bot Artikel Auto
  • Updates: message
  • Webhook URL: n8n auto-generate (contoh: https://n8n.domain.com/webhook/telegram)
  • Set Webhook: di node config, klik Set Webhook (butuh n8n accessible via HTTPS public)
  • Filter Expression (untuk hanya proses command /artikel):
    {{$json.message.text.startsWith('/artikel ')}}
  • Output utama: {{$json.message.text}} (full text), {{$json.message.chat.id}} (chat ID untuk reply), {{$json.message.from.username}} (username pengirim).

Mode B: Long Polling (Simple, Tanpa Domain/HTTPS)

  • Node: Telegram Trigger → Mode: Polling
  • Polling Interval: 3000 (3 detik)
  • Kelebihan: jalan di localhost/VPS tanpa domain, cocok testing.
  • Kekurangan: latency 1-3 detik, beban server sedikit lebih tinggi.

Ekstrak Judul dari Pesan

Tambah node Set setelah Trigger, nama: Normalize Input:

  • Field judul_raw: {{$json.message.text}}
  • Field judul: {{$json.message.text.replace('/artikel ', '').trim()}}
  • Field slug: {{$json.judul.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '').substring(0, 80)}}
  • Field chat_id: {{$json.message.chat.id}}
  • Field tanggal: {{$now.format('YYYY-MM-DD HH:mm:ss')}}

Node 2: Riset Keyword LSI (Opsional tapi Direkomendasikan)

Node: HTTP Request, nama: Get LSI Keywords

  • Method: GET
  • URL: https://serpapi.com/search.json?q={{$json.judul}}&api_key=YOUR_SERPAPI_KEY&engine=google&gl=id&hl=id&num=10
  • Authentication: None (key di query param)
  • Response Format: JSON
  • Set node setelahnya (Parse LSI):
    Field: lsi_keywords
    Value: {{($json.related_searches || $json.people_also_ask || []).map(x => x.query || x.question).join(', ')}}
    

Tanpa SerpAPI: Ganti dengan node Set manual keyword per kategori (misal niche affiliate: “review”, “harga”, “spesifikasi”, “kelebihan kekurangan”, “beli dimana”).

Node 3: AI Generate Outline (Struktur Artikel)

Node: OpenAI (atau Anthropic / HTTP Request ke Gemini), nama: Generate Outline

  • Credential: OpenAI GPT-4o-mini
  • Model: gpt-4o-mini (hemat, 128k context)
  • System Prompt:
    Anda adalah Senior SEO Content Strategist. Tugas: buat outline artikel 3000+ kata untuk WordPress.
    Input: Judul artikel + Keyword Utama + Keyword LSI (pisah koma).
    Output: HANYA JSON array valid, tanpa markdown, tanpa penjelasan.
    Format: [
      {"h2": "Pertanyaan H2 (format tanya jawab untuk AI Overviews)", "points": ["poin kunci 1", "poin kunci 2", "poin kunci 3"], "target_words": 400, "needs_table": true/false, "needs_diagram": true/false},
      ...
    ]
    Aturan:
    - 6-8 H2 sections
    - H2 berbentuk pertanyaan lengkap (What/How/Why/Apa/Bagaimana/Mengapa)
    - Satu section wajib needs_table: true (perbandingan/tools/harga)
    - Satu section wajib needs_diagram: true (deskripsi alur untuk HTML flow diagram)
    - Target total kata: 3000-4000
    - Keyword utama "otomasi artikel SEO WordPress" + LSI tersebar natural
    
  • User Prompt (Expression):
    Judul: {{$json.judul}}
    Keyword Utama: otomasi artikel SEO WordPress
    Keyword LSI: {{$json.lsi_keywords}}
    
  • Output: outline (array JSON)

Node 4: Loop Tulis Section per Section (Split In Batches)

Node: Split In Batches, nama: Loop Sections

  • Mode: Run Once for Each Item
  • Input Data: {{$json.outline}} (dari node Generate Outline)
  • Batch Size: 1
  • Reset: Never

Di dalam loop (connect ke node OpenAI berikutnya):

Node 4a: AI Tulis Section (OpenAI Chat)

  • Credential: OpenAI GPT-4o-mini
  • Model: gpt-4o-mini
  • System Prompt:
    Anda adalah Senior SEO Copywriter Indonesia. Tulis SATU section artikel.
    Format output: HANYA HTML bersih (

    ,

    • ,

      , ,
      ). JANGAN sertakan

      ,

      , , , markdown fence (```html), komentar. Target: {{$item.target_words}} kata. Keyword utama: "otomasi artikel SEO WordPress" (densitas 0.8-1.5%). LSI keywords: {{$json.lsi_keywords}} (sebar natural). Gaya: natural-profesional, E-E-A-T, tutorial praktis, step-by-step bernomor. AWALI 2-3 KALIMAT PERTAMA dengan jawaban langsung pertanyaan H2 (untuk AI Overviews snippet). Jika needs_table=true: buat

      perbandingan minimal 3 kolom 4 baris. Jika needs_diagram=true: buat
      berisi deskripsi alur visual (kotak + panah →) untuk di-render CSS nanti.
    • User Prompt (Expression):
      H2: {{$item.h2}}
      Poin wajib: {{$item.points.join(', ')}}
      Butuh tabel: {{$item.needs_table}}
      Butuh diagram: {{$item.needs_diagram}}
      Keyword LSI: {{$json.lsi_keywords}}
      
    • Options: maxTokens: 4000, temperature: 0.7
    • Node 4b: Wait (Anti Rate Limit)

      • Node: Wait
      • Amount: 3, Unit: Seconds
      • Connect: Output Split In Batches → OpenAI → Wait → Merge

      Node 4c: Merge (Accumulate Sections)

      • Node: Merge, nama: Accumulate Sections
      • Mode: Append
      • Input 1: Output dari Wait (section_html)
      • Input 2: (kosong, untuk item pertama)
      • Output: accumulated_html

      Node 5: Final Merge & Clean HTML (Code Node)

      Setelah loop selesai (connect dari Merge ke Code node Run Once for All Items):

      • Node: Code, nama: Finalize HTML
      • Mode: Run Once for All Items
      • Script (ringkas):
        
        // Input: items dari loop (masing-masing punya section_html, h2)
        const sections = items.map(item => item.json);
        let html = '';
        
        // Gabung section dengan H2 wrapper
        sections.forEach((sec, i) => {
          html += `

        ${sec.h2}

        \n${sec.section_html}\n\n`; }); // Generate FAQ Schema JSON-LD dari H2 yang bentuk pertanyaan const faq = sections .filter(s => s.h2.match(/^(Apa|Bagaimana|Mengapa|Apakah|Bisakah|Di Mana|Kapan|Berapa)/i)) .slice(0, 6) .map(s => ({ "@type": "Question", "name": s.h2, "acceptedAnswer": { "@type": "Answer", "text": s.section_html.replace(/<[^>]+>/g, '').substring(0, 300) + '...' } })); const faqSchema = { "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": faq }; // Meta description (ambil dari section pertama 150 char) const meta = sections[0]?.section_html.replace(/<[^>]+>/g, '').substring(0, 155) + '...'; // Return untuk node berikutnya return [{ json: { final_html: html, meta_description: meta, faq_schema: JSON.stringify(faqSchema), judul: $json.judul, slug: $json.slug, chat_id: $json.chat_id } }];

      Node 6: WordPress Publish (HTTP Request)

      • Node: HTTP Request, nama: Publish to WordPress
      • Credential: WP App Password
      • Method: POST
      • URL: https://aguswibisono.com/wp-json/wp/v2/posts
      • Headers:
        • Content-Type: application/json
        • Authorization: Basic {{$credentials.headerAuth}} (auto dari credential Header Auth)
      • Body (JSON):
        {
          "title": "{{$json.judul}}",
          "content": "{{$json.final_html}}",
          "excerpt": "{{$json.meta_description}}",
          "slug": "{{$json.slug}}",
          "status": "publish",
          "format": "standard",
          "meta": {
            "_yoast_wpseo_metadesc": "{{$json.meta_description}}",
            "_yoast_wpseo_focuskw": "otomasi artikel SEO WordPress",
            "_yoast_wpseo_schema": "{{$json.faq_schema}}"
          }
        }
        
      • Options: Continue On Fail: true, Retry On Fail: 2, Retry Delay: 5000

      Node 7: Telegram Notifikasi Hasil

      • Node: Telegram (Send Message)
      • Credential: Bot Artikel Auto
      • Chat ID: {{$json.chat_id}} (dari input user)
      • Text:
        ✅ Artikel Terpublish!
        
        📝 {{$json.judul}}
        🔗 Link: {{$json.wp_response.link}}
        🆔 Post ID: {{$json.wp_response.id}}
        📅 {{$now.format('DD MMM YYYY, HH:mm')}}
        
        #AutoContent #n8n #AI
        
      • Parse Mode: HTML
      • Options: Disable Notification: false

      Node 8: Error Handling (Error Trigger)

      • Node: Error Trigger (di canvas terpisah, connect ke Telegram Send Message)
      • Nama node notif error: Notify Error
      • Text:
        ❌ Workflow Gagal
        🔧 Workflow: Auto SEO Article
        📝 Judul: {{$json.judul || 'Unknown'}}
        ⚠️ Error: {{$json.error.message}}
        📍 Node: {{$json.error.node.name}}
        ⏰ {{$now.format('DD MMM YYYY, HH:mm')}}
        
      • Di node kritis (OpenAI, HTTP Request WP): aktifkan Continue On Fail + Retry On Fail: 2

      Testing & Go Live Checklist

      Step Aksi Expected Result
      1 Execute Workflow (Manual) → input test judul Semua node hijau, WP post created
      2 Kirim /artikel Test Judul Pertama ke Bot Telegram Trigger jalan, notif sukses datang
      3 Buka link artikel di browser Judul, H2, HTML, meta, FAQ schema tampil benar
      4 View Source → cari application/ld+json FAQ schema valid
      5 Test error: matiin internet / ganti credential salah Error Trigger kirim notif Telegram
      6 Toggle workflow ACTIVE (ikon play hijau) Sistem live, siap terima input 24/7

      Troubleshooting Umum

      Error Penyebab Fix
      Telegram Trigger tidak jalan (webhook) n8n tidak accessible public HTTPS / webhook URL salah Gunakan Polling mode, atau setup Cloudflare Tunnel / Caddy reverse proxy + domain valid
      WP REST API 401 Unauthorized Application Password salah / user tidak punya permission publish_posts Buat App Password baru, pastikan user role Editor/Administrator, test via curl dulu
      OpenAI 429 Rate Limit Terlalu cepat request berurutan Node Wait 3-5 detik di loop, pakai GPT-4o-mini, batch 3 section per prompt
      JSON.parse error di Outline AI return markdown fence atau teks tambahan System prompt: “HANYA JSON array valid, tanpa markdown”. Tambah node Set parse JSON dengan try-catch.
      HTML output berantakan (double H1, markdown) Prompt AI tidak ketat Node Code final: strip “`html, “`,

      ,

      (H2 di-handle parent). Template kelas sudah include cleaner.

      Loop tidak lanjut ke section berikutnya Split In Batches mode salah / koneksi ke Merge putus Mode: Run Once for Each Item. Pastikan Output Split → AI → Wait → Merge (Append) → konek ke node setelah loop.

      Template Siap Pakai: Hanya Import & Isi Credential

      Semua node di atas (termasuk prompt engineering teruji, error handling, logging, quality gate) sudah di-bundle jadi satu file workflow.json di Kelas n8n Karyawan AI. Anda tidak perlu bangun manual node-per-node.

      • ✅ Download workflow.json → Import di n8n (1 klik)
      • ✅ Klik tiap node credential → pilih credential Anda
      • ✅ Ganti domain WP di node HTTP Request
      • ✅ Test 1x → Toggle ACTIVE
      • ✅ Selesai < 30 menit

      ⚡ Skip Bangun Manual, Langsung Pakai Template Teruji

      Dapatkan workflow n8n lengkap (Telegram → AI → WP + Error Handling + Logging + Quality Gate) + 12 modul video + Prompt library 5 niche + Grup support Telegram lifetime

      AMBIL TEMPLATE WORKFLOW n8n SEKARANG

      FAQ: Koneksi Telegram – AI – WordPress

      Bisa pakai Google Sheets 대신 Telegram sebagai trigger?

      Bisa. Ganti node Telegram Trigger dengan Google Sheets Trigger (polling baris baru) atau Webhook (dari form/Typeform/Zapier). Logic workflow setelah trigger sama persis. Template kelas include versi Google Sheets & Webhook.

      Harus pakai 3 AI model (OpenAI, Claude, Gemini) sekaligus?

      Tidak. Cukup 1 model. Template default pakai GPT-4o-mini (hemat, cepat, kualitas bagus). Bisa ganti ke Claude/Gemini hanya ganti credential & node type. Fallback multi-model (jika primary gagal) include di template advanced.

      Data apa yang lewat antar node? Bisa lihat debug?

      Semua data = JSON. Di editor n8n, klik node → panel kanan “Execution Data” → lihat Input/Output JSON tiap run. Untuk debug production, template include node Google Sheets Logger yang catat: timestamp, judul, status, word_count, error (jika ada) ke spreadsheet otomatis.

      Bisa jalan di n8n Cloud Free tier?

      Bisa. 5.000 eksekusi/bln cukup untuk ~100-200 artikel (1 artikel ≈ 10-20 eksekusi: trigger + outline + 6-8 section loop + merge + WP + notif). Untuk volume lebih, upgrade ke n8n Cloud Pro atau pindah self-hosted VPS.

      Bagaimana cara update artikel yang sudah publish (content refresh)?

      Workflow terpisah “Content Refresh”: Schedule mingguan → baca post ID dari Google Sheets → WP GET post → cek performa GSC (klik/impresi turun?) → jika ya, regenerate section lemah → WP PUT update post. Include di bonus workflow kelas.

      Kesimpulan

      Menghubungkan Telegram, AI, dan WordPress dalam satu alur n8n hanyalah urusan: (1) siapkan 3 credential, (2) rangkai 8-10 node standar, (3) test, (4) aktifkan. Yang memakan waktu bukan “nyambungin kabel”, tapi prompt engineering & quality control agar output artikel benar-benar rank & bermanfaat.

      Jangan reinvent the wheel. Gunakan template workflow yang sudah teruji ratusan kali alumni, dengan prompt yang di-refine berbulan-bulan, error handling lengkap, dan support komunitas.

      🎯 Mulai Otomasi Konten Hari Ini — Tanpa Bangun Dari Nol

      Gabung Kelas n8n Karyawan AI → dapatkan workflow.json siap import + video setup lengkap + grup support

      DAFTAR & DOWNLOAD TEMPLATE WORKFLOW

Scroll to Top