Dokumentasi Notifikasi

🔔 Notifikasi

Terima alert bila ada chat baru melalui Telegram, Google Sheets, atau Webhook.

3 Jenis Notifikasi

📱

Telegram

Terima notifikasi terus ke Telegram anda bila ada chat baru.

📊

Google Sheets

Simpan data lead (nama, telefon) automatik ke spreadsheet.

🔗

Webhook

Hantar data ke sistem anda sendiri melalui HTTP POST.

Setup Notifikasi Telegram

Terima mesej notifikasi terus ke akaun Telegram anda bila ada pelanggan baru chat.

Langkah-langkah:

  1. Dapatkan Chat ID anda
    Buka Telegram dan cari bot @userinfobot. Hantar /start dan salin "Id" anda.
  2. Pergi ke Edit Bot
    Dashboard → Pilih Bot → Edit
  3. Masukkan Chat ID
    Di bahagian "Notifikasi Telegram", tampal Chat ID anda
  4. Simpan
    Notifikasi akan aktif serta-merta

Contoh Notifikasi:

🔔 Chat Baru!

Nama: Ahmad bin Ali

Telefon: 012-3456789

Bot: Kedai Tudung Bot

Klik untuk balas dari Dashboard

💡 Tip: Anda juga boleh notify ke group! Tambah bot anda ke group, kemudian dapatkan Chat ID group tersebut.

Setup Google Sheets

Simpan data pelanggan automatik ke Google Spreadsheet untuk pengurusan lead yang lebih baik.

Langkah-langkah:

  1. Cipta Google Sheet baru
    Pergi ke Google Sheets dan cipta spreadsheet baru
  2. Setup header di baris pertama
    A1: Tarikh | B1: Nama | C1: Telefon | D1: Bot
  3. Deploy sebagai Web App
    Extensions → Apps Script → Deploy → New deployment → Web app
  4. Salin Web App URL
    URL akan bermula dengan https://script.google.com/...
  5. Tampal di Edit Bot
    Dashboard → Edit Bot → Google Sheets URL
⚠️ Penting: Pastikan "Who has access" diset ke "Anyone" semasa deploy supaya sistem boleh hantar data.

Contoh Apps Script:

function doPost(e) {
  var sheet = SpreadsheetApp.getActiveSheet();
  var data = JSON.parse(e.postData.contents);
  
  sheet.appendRow([
    new Date(),
    data.name,
    data.phone,
    data.bot_name
  ]);
  
  return ContentService.createTextOutput("OK");
}

Setup Webhook

Hantar data ke sistem anda sendiri melalui HTTP POST. Sesuai untuk integrasi dengan CRM, database, atau sistem custom.

Langkah-langkah:

  1. Sediakan endpoint di server anda
    Endpoint mesti boleh terima HTTP POST dengan JSON body
  2. Pergi ke Edit Bot
    Dashboard → Pilih Bot → Edit
  3. Masukkan Webhook URL
    URL penuh termasuk https://
  4. Simpan
    Webhook akan aktif untuk chat baru

Data yang Dihantar:

{
  "event": "new_conversation",
  "timestamp": "2025-01-15T10:30:00+08:00",
  "bot_id": "abc12345",
  "bot_name": "Kedai Tudung Bot",
  "visitor": {
    "name": "Ahmad bin Ali",
    "phone": "0123456789",
    "session_id": "xyz789"
  },
  "conversation_id": "conv_123456"
}
💡 Tip: Gunakan tools seperti Webhook.site untuk test webhook sebelum integrate dengan sistem sebenar.

Bila Notifikasi Dihantar?

Event Telegram Sheets Webhook
Chat baru bermula
Visitor submit info (nama/phone)
Setiap mesej baru

Nota: Notifikasi hanya dihantar untuk chat baru dan bila visitor submit maklumat. Ini untuk mengelakkan spam notifikasi. Untuk melihat mesej baru, gunakan Dashboard Inbox.

Troubleshooting

  • Pastikan Chat ID betul (guna @userinfobot untuk check)
  • Pastikan anda telah /start bot anda di Telegram
  • Jika notify ke group, pastikan bot adalah admin group
  • Pastikan Apps Script sudah di-deploy sebagai Web App
  • Pastikan "Who has access" = Anyone
  • Check Execution log di Apps Script untuk error
  • Pastikan URL yang disalin adalah Deployment URL, bukan Script URL
  • Pastikan URL menggunakan HTTPS
  • Pastikan endpoint boleh terima POST request
  • Check server logs untuk error
  • Test dengan Webhook.site terlebih dahulu