Start Utilizing Webhooks in Topol PRO
Setting Up a Webhook
Navigate to Editor Settings -> Webhooks:
In the editor settings, find the Webhooks section.
Configure the Webhook:
Enter the URL of your application that will receive the data.
Ensure the URL accepts POST requests and responds with a status code in the 2xx range (e.g., 200 OK) to indicate successful receipt.
Depending on your needs, you can choose to have the webhook triggered automatically whenever a template is saved, ensuring your application always has the latest version. Alternatively, you can manually trigger the webhook from the template preview if you prefer more control over when the data is sent.
Webhook Structure
When a webhook is triggered, it sends the following data to the specified URL in a structured format:
name
: The name of the template.json
: The template's definition in JSON format.html
: The HTML content of the template.status
: The current status of the template.updated_at
: The last updated timestamp of the template in ISO 8601 format.
Verifying Webhook Requests
To ensure the security and integrity of the data being sent, the receiving application can verify the request to ensure it hasn't been tampered with. Upon creating the webhook, a Signature Secret Key is provided, which can be used for verification.
Steps to Verify the Signature
Extract the Signature: Retrieve the signature from the request header (‘Signature’).
Compute Hash: Generate an HMAC-SHA-256 hash of the request content using the secret key.
Compare Signatures: Compare the provided signature with the computed hash securely. If they match, accept the request as valid; otherwise, reject it.
This method ensures that the request is authentic and has not been altered in transit.
Conclusion
By following this guide, you can efficiently set up and use webhooks in the Topol PRO, keeping your application synchronized with the latest email template data. If you have any further questions, feel free to ask!