🔔 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:
-
Dapatkan Chat ID anda
Buka Telegram dan cari bot@userinfobot. Hantar /start dan salin "Id" anda. -
Pergi ke Edit Bot
Dashboard → Pilih Bot → Edit -
Masukkan Chat ID
Di bahagian "Notifikasi Telegram", tampal Chat ID anda -
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
Setup Google Sheets
Simpan data pelanggan automatik ke Google Spreadsheet untuk pengurusan lead yang lebih baik.
Langkah-langkah:
-
Cipta Google Sheet baru
Pergi ke Google Sheets dan cipta spreadsheet baru -
Setup header di baris pertama
A1: Tarikh | B1: Nama | C1: Telefon | D1: Bot -
Deploy sebagai Web App
Extensions → Apps Script → Deploy → New deployment → Web app -
Salin Web App URL
URL akan bermula dengan https://script.google.com/... -
Tampal di Edit Bot
Dashboard → Edit Bot → Google Sheets URL
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:
-
Sediakan endpoint di server anda
Endpoint mesti boleh terima HTTP POST dengan JSON body -
Pergi ke Edit Bot
Dashboard → Pilih Bot → Edit -
Masukkan Webhook URL
URL penuh termasuk https:// -
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"
}
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