Providing webhooks (or web callbacks) is a way for NeoLoad Web to equip other applications with real-time event oriented information, typically a test starting or ending. Third-party applications ranging from email, SMS, and Slack© to more elaborate tools such as Google sheets can thus react as soon as they are notified of these events and trigger their workflow.
Using Webhooks is a useful and straightforward way to execute some third party code via an HTTP request giving an URL. They have become an essential web standard for more than ten years.
Zapier© is a commercial SAAS platform which provides workflows to automate the use of web applications together.
NeoLoad Web 1.5 webhooks feature can easily trigger webhook notifications on load test (or bench as we call them) events. This article describes how NeoLoad Web administrators can configure both Neoload Web and Zapier to emit emails when a test ends after a run in NeoLoad Web Runtime or NeoLoad connected to NeoLoad Web.
How to make these worlds talk together?
At first, to implement a workflow which Zapier calls a “Zap,” create one by clicking on the “Make a Zap!” red button in the top right corner.
Name it “NLW 1.5 Email Notification” for example.
Then choose a trigger app which is the input of the workflow. NeoLoad Web will send the notifications by invoking webhook URLs.
Select the “Webhooks by Zapier” built-in app proposed by Zapier (use the search bar to quickly find the application).
Go to NeoLoad Web, in the “Webhooks” section of the “Account” menu and add a new webhook
NeoLoad Web needs to know what is the URL where the webhook listens to the incoming requests. To see the value of this URL generated by Zapier, go back to Zapier and click on “Save + Continue.” Then copy the value in your clipboard by clicking on the “Copy” button.
Once the URL copied, paste it in the webhook configuration in NeoLoad Web. Give it a name and choose the “Test ended” event.
Then fill the payload with a valid JSON content. Zapier can parse the payload to extract pairs of [key, value]. Add any pair you think you need in the email that will be sent. NeoLoad handles some predefined keys. These keys are variables matching the following format: $() e.g. $(test_project). The variables are instantiated when the event is emitted, and they are replaced by the corresponding values taken from the current bench. The list of available variables are as follows:
For the event “Test ended,” it is possible to use all the available variables. Additionally, add another variable to define the email addresses of the recipients, separated by commas. Call it “EMAIL_ADDRESSES” and fill it with a least one valid email address. Now, the global JSON payload looks like:
Click on the “Test” button to check if the URL is valid and at the same time to send to Zapier a sample payload. In Zapier, click on “Ok, I did this.” Zapiertakes the sample and parses it to provide the variables that will be useful in the future actions of the workflow.
The sample has been received by Zapier. Its name is “Hook A.” Now configure the output of the workflow, E.g., the email sender action.
Set up the next step by choosing the “Email by Zapier” built-in application.
Choose the action “Send Outbound Email.”
Now, it’s time to retrieve the variables parsed from the payload received and used them to set up the email. Click on “Save + Continue.” Zapier shows the different fields of the email to send.
- Put the “Email Addresses” variable in the field “To.”
- Put the “Bench Name” variable in the field “Subject.”
- Put some valid HTML content in the body like this:
Feel free to add others optional fields like “From Name” or “Reply-To.” When done, click on “Continue” to test if Zapier can send the email correctly.
Do not forget to put your Zap on! Run some load tests with NeoLoad Web Runtime (or NeoLoad connected to NeoLoad Web) and receive email notifications when they stop.
Open your mind!
In the same way, you can use the webhooks of NeoLoad Web with many other applications like Slack ©.
Here is an example of a notification received on a Slack channel:
Webhooks are a dominant standard which makes applications even closer to each other. You will never be more aware of NeoLoad test activities than before by receiving notifications by email, mobile and more!
- For more information about NeoLoad Web, go to https://www.neotys.com
- For more information about Zapier, go to http://www.zapier.com
- For more information about Slack, go to http://www.slack.com