Demo.mp4
The Mpesa-AI-WhatsApp-Chatbot is an innovative project that combines the power of OpenAI's language model and LangChain's capabilities to facilitate payments using the MPESA-Daraja API. This chatbot aims to streamline the payment process by enabling users to interact with it through WhatsApp, making transactions more convenient and efficient.
Follow these steps to set up and run the Mpesa-AI-WhatsApp-Chatbot:
-
Clone the Repository: Start by cloning the repository to your local machine using the following command:
git clone https://github.com/Kevin7744/Mpesa-AI-whatsapp-chatbot.git
-
Setup Facebook Developers Account: Create a Facebook Developers account and import the necessary tokens. You can find resources to help you with this here.
-
Install Requirements: Install the required Python packages by running the following command:
pip install -r requirements.txt
-
Set Up Environment Variables: Create a
.env
file in the project directory and add your OpenAI API key. -
Setup Ngrok: Ngrok is used to expose your local server to the web. Setup Ngrok by following the instructions here. Run the following commands to start Ngrok and add your authentication token:
ngrok http 5000 --domain=<domain name> ngrok config add-authtoken <your auth token>
-
Run the Chatbot: Start the chatbot by running the
main.py
file:python main.py
The project is structured as follows:
-
main.py: Contains the main logic for the chatbot, including handling user messages, generating responses using OpenAI, and processing payments using the MPESA-Daraja API.
-
requirements.txt: Lists all the required Python packages for the project. Install these packages using
pip install -r requirements.txt
. -
.env: Environment file to store sensitive information such as API keys. Create this file and add your OpenAI API key.
Contributions to the Mpesa-AI-WhatsApp-Chatbot project are welcome. If you have any suggestions, improvements, or feature requests, feel free to open an issue or submit a pull request on the GitHub repository.
The Mpesa-AI-WhatsApp-Chatbot project is licensed under the APACHE LICENSE. Feel free to use, modify, and distribute the code for your own projects.