WhatsApp Scam Message Classification Using TF-IDF and Naive Bayes Algorithm

Authors

  • Saputra Nugroho Universitas Bina Sarana Informatika
  • Rafani Berlian Rahma Putra Universitas Bina Sarana Informatika
  • Muhamad Rizki Ananta Universitas Bina Sarana Informatika
  • M. Fachri Alfarisi Universitas Bina Sarana Informatika
  • Millian Kemal Nur Ghifari Universitas Bina Sarana Informatika
  • Ahmad Sinnun Universitas Bina Sarana Informatika
  • Muhammad Muharrom Universitas Bina Sarana Informatika

DOI:

https://doi.org/10.59890/ijels.v4i11.115

Keywords:

Whatsapp, Text Classification, TF-IDF, Naive Bayes, Digital Fraud

Abstract

WhatsApp scam messages take different forms, including phishing, fake job offers, fraudulent prizes, and impersonation. The study examines Term Frequency–Inverse Document Frequency (TF-IDF) with Multinomial Naive Bayes to classify scam types based on message text. The initial dataset contained 10,000 rows across 14 categories. After handling empty records, identical messages with conflicting labels, and duplicate text, 8,698 unique messages remained. Stratified sampling split the data at an 80:20 ratio, resulting in 6,958 training messages and 1,740 test messages. TF-IDF and the classifier were placed in a pipeline so that the vocabulary was learned from training data only. The baseline achieved 99.94% accuracy, 92.81% macro-precision, 92.86% macro-recall, and 92.83% macro-F1. However, the SIM Card Replacement Scam class had only one test sample, which was misclassified. The dataset also contains signs of repetitive message patterns. These results do not establish that the model will perform equally well on new, real-world scam messages. Further testing with more varied data, template-grouped splits, or external data is needed.

References

Efendi, F. M., Hadi, F., & Pratama, S. (2025). Analisis Dan Perancangan Sistem Pendeteksian Phishing Berbasis AI Pada Platform Whatsapp Dengan Pendekatan Bahasa Lokal Surabaya. 267–275.

Gerliandeva, A., Chrisnanto, Y. H., & Ashaury, H. (2024). Optimasi Klasifikasi Sentimen pada Komentar Online menggunakan Multinomial Naïve Bayes dan Ekstraksi Fitur TF-IDF serta N-grams Optimization of Sentiment Classification on Online Comments using Multinomial Naïve Bayes and TF-IDF Feature Extraction and N-g. (X), 259–272. https://doi.org/10.56873/jpkm.v9i2.5585

Hadi, A., Qamal, M., & Afrillia, Y. (2025). Comparison of Random Forest Algorithm Classifier and Naïve Bayes Algorithm in Whatsapp Message Type Classification. 9–17.

Irawan, D., Perkasa, E. B., Wahyuningsih, D., & Helmud, E. (2021). Perbandingan Klassifikasi SMS Berbasis Support Vector Machine , Naive Bayes Classifier , Random Forest dan Bagging Classifier. 10, 432–437.

Jesus, A. De, Katemba, P., Nubatonis, E. R., Informatika, T., & Uyelindo, U. (2026). ANALISIS PHISHING PADA PESAN WHATSAPP MENGGUNAKAN LSTM. 12(2), 375–384. https://doi.org/10.46880/mtk.v12i2.6268

Kristian, D. J. K., & Nurdiyah, D. (2026). Analisis Sentimen Terhadap Aplikasi Whatsapp Menggunakan Naïve Bayes Berdasarkan Seleksi Fitur Chi-Square. Jurnal Transformatika, 23(2), 193–201. https://doi.org/10.26623/transformatika.v23i2.12310

Manurung, F. A., & Pradeka, D. (2025). Spam and Phishing Whatsapp Message Filtering Application Using TF - IDF and Machine Learning Methods. 5(1), 1–13.

Ramdani, M., Hamdani, M. R., Prayoga, I. R., Lestari, S. B., Prabowo, B. H., Wibawa, S., & Muharrom, M. (2025). Penerapan Algoritma Naïve Bayes Menggunakan Python Untuk Mendeteksi Sms Spam Dan Promo. INFOTECH Journal, 11(2), 377–385. https://doi.org/10.31949/infotech.v11i2.16392

Sari, F., Febiharsa, D., Sains, F., & Ivet, U. (2026). Optimasi Algoritma CART untuk Deteksi Kejahatan Siber pada Pesan WhatsApp Berdasarkan Pola Bahasa. 6(1), 7–17.

Sunardi, Fadlil, A., & Perdana Kusuma, N. M. (2023). Cyber Fraud Profiling With Routine Activity Theory Using Data Mining Techniques. Malaysian Journal of Computing, 8(2), 1517–1533. https://doi.org/10.24191/mjoc.v8i2.23391

Thalkiya, S., Sonawane, H., Ingale, S., & Yelalwar, R. G. (2025). WhatsApp Chat Analyzer with Sentiment Analysis. SSRN Electronic Journal, 1–13. https://doi.org/10.2139/ssrn.5752802

Downloads

Published

2026-11-30