To ensure that the Webhook request truly comes from Ragic and that its content has not been tampered with, Webhooks configured as "Send full content of changed record." will include a signature in the request.
After receiving the Webhook, you can use the public key we provide to verify the signature.
If verification fails, it means the request may have been tampered with, and it is recommended to reject processing.
1.1. Extract the data property from the Webhook request. (The data property should be in JSONArray format)
1.2. Serialize it into a JSON string with keys sorted alphabetically, no indentation, and no line breaks. In other words, "for each object in the JSONArray, reorder all fields alphabetically, then output as a single-line JSON".
// Before conversion (original data property): [ { "1001030":"banana", "1001029":"apple" } ] // After conversion (string-to-sign): [{"1001029":"apple","1001030":"banana"}]
Note: If the serialization method is inconsistent with ours, the signature verification will fail.
2.1. Extract the signature property from the Webhook request.
2.2. Download the public key (see "Get Public Key").
2.3. Use a verification tool that supports SHA256withRSA.
2.4. If verification succeeds, it means the request is from Ragic and its content has not been tampered with.
We provide two ways for you to obtain the public key. Choose the one that best fits your use case:
1. Get the public key string directly by calling: https://www.ragic.com/api/http/getWebhookSignaturePublicKey.jsp?type=string
2. Click here to download the PEM file.
It is recommended to cache the public key on your server and only re-download it on startup.