This project demonstrates the integration of a Flask application with Twilio to handle incoming messages via a webhook.
This Flask application receives incoming SMS messages using a Twilio webhook, processes the message content, and responds with a confirmation message including the received text.
When a message is sent to your Twilio number, Twilio will send a POST request to the /api/message
endpoint of this application. The application then extracts the message content, processes it, and sends back a response acknowledging the received message.
-
Clone the repository:
git clone https://github.com/thiunuwan/flask-twilio-webhook.git cd flask-twilio-webhook
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the Flask application:
python app.py
-
Set up a ngrok tunnel (optional for local development):
ngrok http 5000
-
Configure your Twilio number's webhook URL to point to your server's URL followed by
/api/message
.