This quick demo shows how to verify an incoming Webhook signature by decoding the incoming JWT sent by Vonage.
For signed incoming SMS signatures through the Messaging API, please see the snippet for verifying a signed incoming SMS message instead.
You may want to use a localhost tunnel agent such as ngrok for local testing.
Install dependencies with pip in a virtual environment:
python3 -m venv venv
. ./venv/bin/activate
# Point to the requirements file in the root of the python-code-snippets repo
pip install -r requirements.txt- Start ngrok with
ngrok http 8000. ngrok will give you a forwarding address you can now use to recieve event webhooks. - Go to the Customer Dashboard.
- Click on "Applications".
- Click the three dots and select "Edit" for the application you are using.
- Under "Capabilities", enter
https://your-ngrok-url/eventsfor the Voice capability. - Click "Save".
Run the FastAPI server with
fastapi dev decode-jwt/main.pyYou can now create a voice call using the voice sample in this repo. This sample app will verify the incoming signature.