To ensure the integrity and authenticity of webhook messages sent by Travtus, webhook signatures are used. This process helps to verify that the messages are indeed from us. For a more detailed explanation, check out this article on why you should verify webhooks.
from svix.webhooks import Webhooksecret = "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"# These were all sent from the serverheaders = { "svix-id": "msg_p5jXN8AQM9LWM0D4loKWxJek", "svix-timestamp": "1614265330", "svix-signature": "v1,g0hM9SsE+OTPJTGt/tmIKtSyZlE3uFJELVlNIOLJ1OE=",}payload = '{"test": 2432232314}'wh = Webhook(secret)# Throws on error, returns the verified content on successpayload = wh.verify(payload, headers)
To set up webhooks and ensure they are authenticated properly, follow these steps:
Request Webhook Setup: Contact support@travtus.com to request the setup of your webhook. Provide the URL where you would like to receive webhook events.
Receive Webhook Credentials: Once the webhook is set up, you will receive a webhook secret (whsec_...) from Travtus. This secret is used to verify the authenticity of incoming webhook events.
Configure Webhook Verification: Use the Svix libraries to configure webhook verification in your application. Below are examples in various programming languages.