1. ProTop Knowledge Base
  2. ProTop Alerts Dashboard

Warming up to Webhook

Here, we discuss what is involved in setting up the ProTop Portal to communicate with a Webhook-enabled system (aka Scripted REST API)

This approach can test communications from ProTop Portal Alert Responses and your Webhook-enabled application (i.e. ServiceNow). As we do not have a working Webhook API we will use the dummy/test website webhook.site to create, test, and validate the creation of webhook based alert response service on the ProTop Portal.

Start by pointing your browser to webhook.site.  It requires no registration or login for testing purposes. It will provide a unique URL for your testing that lasts 7 days.  Copy the URL you see displayed there (not the URL in the address bar).

Setup

Create a new alert response service in your ProTop Portal by clicking the Alert Responses icon in the left side menu:

Then click the Manage Alert Response Services button:

And finally, click the Create Alert Response Service button and select Webhook from the dropdown:

The form to create a Webhook service appears on the right:

image.png
 
Give your service a name.
Paste the URL you obtained from webhook.site into the URL field.
Now ...

Test 1:  

HTTP Method - set it to POST and click the TEST button at the bottom of the form. You see the Webhook Test Result pop-up that looks something like this:

image.png

There is not much going on here as there is no response body. You will get a response body when testing an actual webhook configuration set up to send a response. This pop-up is telling us the URL is valid.
Check the output of the test on the left of the webhook.site.  The most recent output link is at the top left; when clicked, it will display details on the right. This output is just a validation that a round trip occurred:
image.png


Test 2:  

Add the query string.  The template can be found under the info link. Click “i” in the circle (the red box here)

image.png

Here is the template:   

title={notificationTitle}&myQueryParam=abc&text={notificationText}

Copy and paste the template into the Query String Template field and modify it to make it yours.

Click the TEST button at the bottom. The same screen as above will display on the portal but the most recent test result on the webhook.site will now show your query strings (bottom left):

image.png


Test 3:  

Add headers. Use the example shown in the box:  
Content-Type=text/plain,Authorization=Bearer 4321 
Press the TEST button. Again you will see the same pop-up on the portal.  
Check the most recent test output on webhook.site, headers now appear in the upper right quadrant:

image.png

Test 4:

And finally, we add a payload. The payload template can be found under the info link. Click “i” in the circle (the red box here)

image.png
Copy the string under Template variables in request payloads at the bottom of the popup.
 
Here is the template:
{ "myPayloadParameter": "Hello from ProTop", "notificationSbj": "{notificationTitle}", "msg": "{notificationText}" }

Paste it into the payload template field in the form and edit it to make it yours.
Press the TEST button.  Again, we see the same pop-up on the portal.
Check the last test results (top left) on webhook.site.  
It should look something like this. See Raw Content at the bottom of this image:
 
image.png

Dynamic variable substitution

The template values notificationTitle and notificationText are replaced in the query strings and or the payload (if used) with the values in the portal for the page alert that triggered this webhook alert response.
Example:  For this alert response service:
image.png
And this alert response definition based on the above service:
 
image.png
When this PAGE alert arrives at the portal:

image.png
This webhook message is sent to the URL:

image.png
 
NotificationTitle and notificationText are dynamically replaced when the webhook is triggered.
However, for Query strings and/or Payload, you CAN add other fixed field value pairs in the definition, like the values you might use to create a ticket from the body of an email.