Skip to content
المشاريع

حول

This is a WhatsApp AI bot that uses various AI models, including Deepseek, GPT, DALL-E, Gemini and StabilityAI, to generate responses to user input.

الذكاء الاصطناعي وتعلّم الآلة

كيف تُقاس هذه الأرقام

ما يمكنك فعله

  • WhatsApp connection via Baileys, with QR login and persistent sessions
  • Messages are batched per conversation and answered with prior context
  • OpenAI models through a ChatGPT subscription
  • Web search tool powered by Exa

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
+١
خلال 15 يومًا
+٢
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

WhatsApp Agents 🚀

WhatsApp Agents connects an AI agent to WhatsApp. Incoming messages are queued per conversation and answered by an agent that can use tools such as web search. The agent's behaviour is set by an editable instructions file, not by code.

Table of Content

Features

  • WhatsApp connection via Baileys, with QR login and persistent sessions
  • Messages are batched per conversation and answered with prior context
  • OpenAI models through a ChatGPT subscription
  • Web search tool powered by Exa
  • Agent instructions loaded from agents/instructions.md
  • PII guard: personal data is swapped for placeholders before reaching the model (see Privacy)

Privacy

The model never sees customers' personal data.

in:  "call me on 0300 1234567"  →  model sees "call me on [PHONE_1]"
out: "we'll call [PHONE_1]"      →  customer sees "we'll call 0300 1234567"
  • Detection runs in two layers. Pattern matching with checksum validation catches phone numbers (international), emails, CNICs, cards, IBANs, passwords and OTPs. An optional GLiNER service adds multilingual detection of names, addresses and IDs.
  • Per-chat vault. Each chat has its own placeholder map. Placeholders can only be restored in the chat that created them. Values are encrypted at rest (AES-256-GCM) and looked up by keyed hash.
  • Tool guard. Web search refuses queries that contain personal data or placeholders.
  • Fail-safe. If the detection service is down, pattern matching still runs.

Demo

Gemini

Screenshot (1186)

Stability AI + Chat-GPT

image

Dalle + Custom Model

image


Usage

1. Get the code

git clone https://github.com/Zain-ul-din/WhatsApp-Ai-bot.git
cd WhatsApp-Ai-bot
pnpm install

2. Configure

Copy .env.example to .env and fill in the credentials. Then write your agent's instructions in agents/instructions.md. If the file is missing, a generic default is used.

3. Run

pnpm start

Or run the bot together with the PII detection service: docker compose up -d --build (see Deployment).

Scan the QR code with WhatsApp (Linked devices → Link a device).

Disclaimer

This bot utilizes baileys to operate an actual instance of Whatsapp Web to prevent blocking. However, it is essential to note that model and tool providers may charge for every request made. Please be aware that WhatsApp does not support bots or unofficial clients on its platform, so using this method is not entirely secure and could lead to getting blocked.

Contributors

Sponsors

A big thank you to these people for supporting this project.

Levitco
Levitco
Anas Ashfaq
Anas Ashfaq
You
YOU?

Useful links

♥ Sponsor 💎 Bounty 🚀 Deployment ✉ WhatsApp Group
Link Link Link Link
Featured on Aura++

About Us

This repository is maintained by Zain-Ul-Din

Show some ❤️ by starring this awesome repository!

Buy Me A Coffee

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…