Cara Membuat Bot Telegram Absensi Face Recognition (5 Menit)

⚡ Quick Start - 5 Menit Setup
🎯 Goal
Setup bot attendance dalam 5 menit dan langsung bisa presensi!
📋 Step-by-Step
1. Install Dependencies (1 menit)
npm install node-telegram-bot-api form-data
2. Create Bot Token (2 menit)
- Buka Telegram
- Chat dengan @BotFather
- Kirim
/newbot
- Ikuti instruksi
- Copy token yang diberikan
3. Setup Environment (1 menit)
Buat file .env
:
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrs API_BASE_URL=http://localhost:5000 API_KEY=your-secret-api-key-here
4. Run Bot (30 detik)
node attendance_bot.js
5. Test Bot (30 detik)
- Chat bot Anda di Telegram
- Kirim
/setid K001
- Kirim lokasi (📎 → Location)
- Done! ✅
💡 User Guide (Untuk Karyawan)
Pertama Kali
1. Chat bot di Telegram 2. /start 3. Selesai! (Wajah Anda harus sudah terdaftar di sistem)
Setiap Hari
PAGI: 1. Kirim lokasi (📎 → Location) 2. Kirim foto selfie → Auto Check-In dengan face recognition! PULANG: 1. Kirim lokasi (📎 → Location) 2. Kirim foto selfie → Auto Check-Out dengan face recognition!
THAT'S IT! 🎉
🔍 Troubleshooting
Problem Solution Bot tidak response Check token di .env "Employee ID not found" Setup dulu: /setid K001
"Lokasi tidak valid" Pastikan di area kantor "API connection failed" Check API server running 📸 Screenshots
Setup Employee ID
You: /setid K001 Bot: ✅ Setup Berhasil! ID: K001 Nama: John Doe Posisi: Software Engineer Sekarang kirim lokasi untuk presensi otomatis!
Check-In
You: [📍 Send Location] Bot: ⏳ Memproses check-in... ✅ Check-In Berhasil! 👤 John Doe 🆔 K001 📍 Kantor Pusat Jakarta ⏰ Senin, 7 Oktober 2025 08:30
Check-Out
You: [📍 Send Location] Bot: ⏳ Memproses check-out... ✅ Check-Out Berhasil! 👤 John Doe 📍 Kantor Pusat Jakarta ⏰ Senin, 7 Oktober 2025 17:30 ⏱️ Durasi: 9 jam 0 menit
🎓 Advanced Tips
Dengan Face Recognition
Kirim lokasi dan foto bersamaan:
- 📎 → Photo → Pilih foto
- Add caption: [lokasi]
- Atau kirim lokasi dulu, foto dalam 30 detik
Cek Status
/status
Lihat apakah sudah check-in atau belum hari ini
Lihat Laporan
/report
Lihat presensi bulan ini
Lokasi Kantor
/locations
Lihat semua lokasi kantor yang valid
🚀 Production Checklist
- [ ] Ganti API_KEY default
- [ ] Setup HTTPS untuk API
- [ ] Enable rate limiting di API
- [ ] Setup logrotate
- [ ] Use PM2 atau Docker
- [ ] Monitor logs
- [ ] Backup employee ID mappings
- [ ] Test dengan multiple users
- [ ] Setup alerting untuk errors
📞 Need Help?
- 📖 Full documentation: README.md
- 🐛 Issues: GitHub Issues
- 💬 Questions: [email protected]
- 📱 Telegram: @YourSupportBot
Selesai! Bot siap digunakan. ✨