Creating and testing your webhook
You will need to provide an endpoint that functions as a webhook, and Lasso will then send notifications to this webhooks everytime a relevant event is fired.
Requirements
A webhook is an endpoint that receives data when something happens. In this case, the webhook is created and hosted by you, and Lasso will send it data whenever an event is fired. Your webhook must satisfy the following conditions:
- Be publically available over the internet, e.g. on https://mywebsite.com/webhook
- Accept a HTTP POST request with a body as described in the webhook payload section.
- Optionally, the webhook can be require authentication.
Once your webhook is set up, you're ready to register it in a Lasso monitor.
Expected response
Your webhook must respond with a statuscode in the 200-299 range to be considered succesful. If it does not, we will retry several times. Read more here.
Error handling
If your webhook does not respond with a statuscode in the 200-299 range, we will retry up to 5 times in the next 24 hours, with an increasingly longer delay between each attempt. The first retry attempt will wait 5 minutes, then 30 minutes, then several hours. Each retry might have a little time added to it, in order to space out bursts of calls that may be overloading your webhook.
If your webhook does not respond succesfully to any requests at all in a 24-hour period, it will be disabled and you will receive a warning e-mail.
Create a webhook
In order to listen for events you first have to set up your monitor. Monitors are created and set up in the Overvågning module in Lasso. Contact Lasso if you do not yet have access to the Overvågning module.
Once in Overvågning, create a monitor that monitors your desired target group, or choose to monitor everything. You'll receive webhooks when something happens to companies you're monitoring.
When editing the monitor, look for the Webhook section to register your webhook:
Fill out the relevant fields:
- Hændelser: Select the event types you want your webhook to receive. See event types.
- Sikkerhed: If your webhook has authentication, set it up here.
- Webhook URL: Enter the webhook URL that you created in step 1
When the webhook is set up, save the monitor. If your monitor is activated you will start receiving webhooks right away. If you wish to test your webhook before enabling it, make sure the monitor is disabled.
Test your webhook
We provide an endpoint you can call to test the webhook that you set up in the previous section. When calling this endpoint, Lasso will send a test notification to your webhook and report back whether it was successful or not.
To test your webhook, do the following: Send a POST request to the below endpoint where you include your webhook URL, your API Key and the Lasso Id for the company you want to send a test notification for. If Lasso Id not provided, data for Lasso X will be sent.
POST https://api.lassox.com/apps/monitoring/testwebhook?url={YOUR_WEBHOOK_URL}&lassoId=CVR-1-{CVR_NUMBER}&accessKey={API-KEY}
Lasso will then send an example payload to your webhook.
If you receive a result code 204 from Lasso, your webhook successfully handled the notification sent by Lasso. If your webhook fails to receive the notification, an error message including error details will be returned to you.
Once your webhook is tested to be working, you're ready to register it in Lasso to begin receiving data!