Skip to content

WaBotAI is an AI-based WhatsApp Bot that leverages Twilio and OpenAI services to deliver intelligent responses.

License

Notifications You must be signed in to change notification settings

hend41234/WaBotAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaBotAI

WaBotAI is an AI-based WhatsApp Bot that leverages Twilio and OpenAI services to deliver intelligent responses.

Description: WaBotAI is designed to enhance your WhatsApp messaging experience by incorporating artificial intelligence for intelligent and context-aware responses.

1. TWILIO Account Setup

Get started by registering for a free Twilio account at Twilio. Obtain your Account SID and Auth Token from the Twilio Console.

  • Account SID and Auth Token Configuration: Open the file app/api/message/get_message.py in your code editor. Locate the variables account_sid and auth_token and replace 'YOUR_ACCOUNT_SID' and 'YOUR_AUTH_TOKEN' with your Twilio account SID and auth token.

    from app.api.message.create_message import CreateMessage
    from twilio.rest import Client
    import time
    import json
    
    account_sid = 'YOUR_ACCOUNT_SID'
    auth_token = 'YOUR_AUTH_TOKEN'
    client = Client(account_sid, auth_token)
    
    class GetMessage:

2. OPENAI Account Setup

If you don't have an OpenAI account, register at OpenAI Platform. Obtain your API Key from the API Keys section.

  • API Key Configuration: Open the file app/api/gpt/gpt.py in your code editor. Locate the variable api_key and replace 'YOUR_API_KEY' with your OpenAI API key.

    import os
    from openai import OpenAI
    
    api_key = "YOUR_API_KEY"
    
    client = OpenAI(api_key=api_key)
    
    def gpt(message):

3. Setting Up Ngrok Server

If you want to use another server, skip this step.
It will be used to capture messages thrown from Twilio.

  • Installation:

    • Install Ngrok via Apt:
    $ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
    • Install Ngrok via Snap:
    $ snap install ngrok
  • Auth Token:

    $ ngrok config add-authtoken <token>

    If you don't have an auth token, sign up here and obtain the token from Ngrok Dashboard.

4. Tunneling

  • Installing Requirements: Run:

    pip install -r requirements.txt
  • Setting up Twilio Webhook: Use the server address that will be used to capture messages from Twilio.
    Use your own server address if you don't use ngrok.

    Obtain the Ngrok domain from Ngrok Dashboard. Update the Twilio sandbox settings to use the Ngrok domain.
    e.g :

    https://your-server.com/api/wa
    

    Don't forget to add /api/wa.

  • Running Ngrok:

  • Skip this step if you're using your own server.

    ngrok http --domain=your-domain.ngrok-free.app 8000
  • Running the Application:

    python main.py

Contributing

Contributions to WaBotAI are welcome! Feel free to open issues, submit pull requests, or improve the documentation. Together, we can make WaBotAI even better.

License

License: MIT

This project is licensed under the MIT License - see the LICENSE file for details.

About

WaBotAI is an AI-based WhatsApp Bot that leverages Twilio and OpenAI services to deliver intelligent responses.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages