This quick demo shows how to verify an incoming Webhook signature. Your account must be enabled for signed webhooks, and you must have an existing application with the "Messages" capability enabled.
For signed incoming SMS signatures through the Messaging API, please see the snippet for verifying a signed incoming SMS message instead.
Install using either pipenv or virtualenv, and then set up the webhooks.
- Run
pipenv install - Copy
.env.distto.envand fill in your credentials - Run
pipenv run flask
- Run
virtualenv env - Run
source env/bin/activate - Run
pip install -r requirements.txt - Copy
.env.distto.envand fill in your credentials - Run
flask run
- Start ngrok with
ngrok http 3000. ngrok will give you a forwarding address you can now use for your delivery receipts. - Copy this URL and go to your customer dashboard
- Click on "Your Applications"
- Click the three dots and select "Edit" for the application you are using on the application you are using
- Under "Capabilities", enter
https://your-ngrok-urlfor the "Inbound URL" and "Status URL" boxes, and makes sure both are set to "POST" - Click "Save"
You can now send an SMS to the number linked in your application, and the sample app will verify the incoming signature.
