python-whatsapp-bot  by daveebbelaar

Python script for AI WhatsApp bot creation

created 1 year ago
1,297 stars

Top 31.4% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a Python framework for building AI-powered WhatsApp bots using the Meta Cloud API and Flask. It targets developers looking to integrate real-time messaging with AI models like OpenAI for automated customer service, information retrieval, or interactive applications. The primary benefit is a structured, Python-centric approach to leveraging WhatsApp's messaging capabilities with advanced AI.

How It Works

The project utilizes Flask to create a web server that listens for incoming WhatsApp messages via webhooks. It leverages the Meta Cloud API for sending and receiving messages. For AI integration, it provides a clear pattern for implementing custom response generation logic, with a specific example demonstrating integration with the OpenAI Assistants API, allowing bots to process complex queries and retrieve information.

Quick Start & Requirements

  • Install dependencies: pip install -r requirements.txt
  • Run the Flask app: python run.py
  • Expose the local server using ngrok with a static domain.
  • Requires a Meta developer account, a Meta Business App, and an OpenAI API key.
  • Refer to official Meta WhatsApp API documentation and provided video tutorials.

Highlighted Details

  • Integrates with OpenAI Assistants API for advanced AI responses.
  • Handles webhook security verification for secure communication.
  • Supports long-lived access tokens for production use.
  • Provides guidance on managing phone numbers for production.

Maintenance & Community

  • Tutorials and guides are provided by Datalumina.
  • Video tutorials available on YouTube: youtube.com/@daveebbelaar.

Licensing & Compatibility

  • The repository does not explicitly state a license in the README.

Limitations & Caveats

The initial setup for webhooks and ngrok configuration is described as the most challenging part. Sending the first message to a user requires a template message type. The project is presented as a guide and framework, implying that significant custom development is needed for specific AI integrations and bot functionalities.

Health Check
Last commit

1 year ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
1
Star History
154 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.