Lipa fees is an instruction driven WhatsApp Chatbot that allows students to conveniently pay their fees to institutions using M-PESA, a mobile money service. Users replace the UPPER texts with actual values and after confirming pay, an STK push is initiated directly to their phones.
This is a prototype version which uses M-PESA's simulation sandbox to push prompts and should therefore not be used to make actual payments

- Clone this repository
git clone https://github.com/hawkinswinja/lipa_fees.git- Navigate to the project directory:
cd lipa_fees- Install requirements:
pip install -r requirements.txt- Set up environment variables
- Register accounts on twilio and M-PESA API
- Set the app's secret key under the environment variable
SK - Set up environment variables
CSandCKusing values from Daraja App's Consumer and Secret Key - Set up environment variables
ACCOUNT_SIDandAUTH_TOKENusing credentials from Twilio account - Replace the variable
pkin chatbot.py with your daraja App's passkey
- Run the command
flask --app chatbot run- Install
Ngrokand expose the application
ngrok http 5000- Update the status url of your sandbox settings in Twilio and the CallBackURL key of variable payload inside the chatbot.py to match your public url provided by Ngrok.
- Open WhatsApp and text
your sandbox codeto the number of your Twilio account eg.- Text
join birds-yearto+1 (415) 523-8886for this project's test.
- Text
- Initiate payment by texting
/start - Reply as instructed by the chatbot's prompt replacing all the text in upper case with real values.
Contributions are welcome! To contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature. - Make your changes and commit them:
git commit -m 'Add some feature'. - Push to the branch:
git push origin feature/your-feature. - Open a pull request.
This project is licensed under the MIT License.