How to have Validis tell your systems when an upload changes status
Rather than polling Validis to find out whether an upload has finished, you can have Validis tell you. Point the webhook at a URL of your own, and every time an upload changes status, we send a small message to it.
The webhook comes with the Validis API product. If the API is not enabled on your portal, speak to your Validis representative about adding it.
Please note
You need the appropriate permissions to reach Portal Settings.
Finding the settings
Select the settings icon at the top right of the portal, beside the help icon.
That opens Portal Settings. In the menu on the left, select API under Integration. The webhook settings are on that page, below your API keys, in the section headed Upload Webhook.
Switching the webhook on
Use the toggle on the right of the Upload Webhook heading. The settings appear once it is on, and the same toggle switches the webhook off again later without losing what you have entered.
Enter the destination in the Webhook URL, which is required. Include the protocol at the front, so https:// and then the address, rather than the address on its own.
Select Save. A Shared Secret Key is generated for you at that point, which is why the field is empty until you have saved a URL. The eye icon reveals the key, the icon beside it copies the key, and Regenerate Key replaces it with a new one.
Copy the key somewhere safe. Your receiving system needs it to check that the messages arriving really came from Validis, which the next section covers.
Checking that a webhook came from us
Your webhook URL is a public address, so anything on the internet can post to it. The shared secret is how your system tells a genuine Validis message from a forged one, and how it detects a message that was altered on the way.
Every request we send carries two headers.
| Header | What it is |
|---|---|
| x-signature | A signature generated from your secret key and the request body, so you can confirm the message is ours and has not been changed. |
| x-timestamp | A UNIX timestamp in milliseconds recording when we sent the message. |
To verify a request, compute an HMAC-SHA256 of the raw request body using your shared secret, and compare the result with the x-signature header. Use a constant-time comparison rather than an ordinary string match. If the two do not agree, reject the request and do not process the payload.
Compute the signature over the body exactly as it arrived, before any parsing or reformatting. Re-serialising the JSON first is the usual reason a correct implementation fails to match.
You can also check the age of a message using x-timestamp, and treat anything older than five minutes as suspect. Worth knowing where the limits of that check are: the timestamp is not covered by the signature, so it is a sanity check for stale or duplicated messages rather than a security control in its own right.
Please note
Selecting Regenerate Key gives you a new secret, and signatures are built from the new one straight away. Update your receiving system at the same time, or it will reject every message we send.
What Validis sends
Each notification arrives at your URL in this shape:
{
"event": "String",
"status": "String",
"clientId": "uuid",
"engagementId": "integer",
"externalEngagementId": "String",
"uploadId": "uuid",
"apiUrl": "url"
}| Field | What it holds |
|---|---|
| event | Always UPLOAD. A change of upload status is currently the only event the webhook covers. |
| status | The upload status: LOADING, ABORTED, PROCESSING, FAILED or COMPLETED. |
| clientId | Your unique identifier. |
| engagementId | The unique identifier for the engagement. |
| externalEngagementId | A free text field you can set in Validis, used as your own engagement identifier. |
| uploadId | The unique identifier for the upload. |
| apiUrl | The root URL to use when requesting the data through the API. |
A typical use is to watch for a status of COMPLETED and then call the API using the apiUrl and uploadId from the same message.