You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many ways you can write a webhook handler. You could use traditional languages such as Node.js (using Express.js), Python (using Flask) or Ruby (using Sinatra). Also very popular is the use of serverless functions such as AWS Lambda or Google Cloud Functions. You could also use low-code/no-code platforms such as Zapier, Make or Automate.io. Another option is to use an existing platform that supports webhooks such as ServiceNow or HPE OpsRamp.
39
38
@@ -50,9 +49,7 @@ Additional requirements for writing a webhook handler for HPE GreenLake include:
50
49
* The endpoint needs to use HTTPS
51
50
* The handler needs to respond to the initial challenge through the use of a shared secret key
52
51
53
-
## \
54
-
55
-
Taking the challenge
52
+
## Taking the challenge
56
53
57
54
From the picture above, you can see that the webhook handler is a piece of code that runs outside of the HPE GreenLake cloud, possibly posing a security risk. In order to avoid calling a rogue code, HPE GreenLake will establish a trust relationship with the webhook handler by issuing a challenge request and expecting a very specific response. The challenge is an HTTP POST request that is sent to the webhook handler (via its URL) with a payload containing a **challengeRequest** as shown below:
58
55
@@ -71,14 +68,11 @@ From the picture above, you can see that the webhook handler is a piece of code
71
68
}
72
69
```
73
70
74
-
\
75
71
The mission of the challenge handler is to provide the correct answer to the challenge in a timely fashion and with an HTTP response in the following form:
Where **<CHALLENGE-RESPONSE>** is the computed [SHA-256](https://en.wikipedia.org/wiki/SHA-2)[HMAC](https://en.wikipedia.org/wiki/HMAC) (Hash-based Message Authentication Code) of the **challengeRequest** provided in the input payload.
84
78
@@ -129,11 +123,9 @@ Now that you have a clear understanding of what has to be done within a webhook
129
123
130
124
I decided to use Make (previously known as Integromat , which was a great name as it was a contraction of Integration-Automat and that is exactly what it is) to demonstrate this because:
131
125
132
-
\- it doesn’t require any specific programming language knowledge
133
-
134
-
\- it provides a FQDN of the webhook over HTTPS
135
-
136
-
\- it’s free for simple prototyping usage
126
+
* it doesn’t require any specific programming language knowledge
127
+
* it provides a FQDN of the webhook over HTTPS
128
+
* it’s free for simple prototyping usage
137
129
138
130
It turned out to be a very elegant and fast way to get the work done.
139
131
@@ -149,9 +141,9 @@ Give it a name and leave the rest of the settings as their defaults.
149
141
150
142

151
143
152
-
You can already copy address to clipboard to get the URL of your webhook. **Save it** for later.
144
+
You can already **Copy address to clipboard** to get the URL of your webhook. Save it for later.
153
145
154
-
Select the **Add** button, then click on **Show Advanced Option** to add a data structure using the payload example from the Take the challenge section above. Click ge**nerate,** paste the JSON and save it as **challenge**.
146
+
Select the **Add** button, then click on **Show Advanced Option** to add a data structure using the payload example from the Take the challenge section above. Click **generate,** paste the JSON and save it as **challenge**.
155
147
156
148
Make sure the **challenge** data structure is selected in the advanced settings of the Webhooks module before continuing.
157
149
@@ -166,20 +158,19 @@ Configure the Set variable module with:
Note: *you can drag the **challengeRequest** property from the **Webhooks** module, and drop it as your first parameter. **<SecretKey>** is a placeholder which you will replace later, once we know the the real shared secret key.*
161
+
Note: you can drag the **challengeRequest** property from the **Webhooks** module, and drop it as your first parameter. **<SecretKey>** is a placeholder which you will replace later, once we know the the real shared secret key.
170
162
171
163

172
164
173
-
\
174
165
The final step is to prepare the response of the webhook. For this, you need to add another module after the **Set variable** module, called **Webhook response**.
Set the status to **200** and the body to **{ “verification” : “”}**,then drag/drop the **hmac** property from the **Set variable** step in between the double quotes.
169
+
Set the status to **200** and the body to **{"verification":""}**,then drag/drop the **hmac** property from the **Set variable** step in between the double quotes.
In the advanced settings, add a custom header for content-type: application/json
173
+
In the advanced settings, add a custom header for **content-type: application/json**
183
174
184
175
Your overall workflow basically looks like this:
185
176
@@ -244,7 +235,6 @@ Create a second Postman **POST** request using the same webhook URL but this tim
244
235
245
236

246
237
247
-
\
248
238
Click **Send** in Postman, and check in Make (in the scenario’s history) that the second route was taken, as shown below.
249
239
250
240

@@ -284,7 +274,7 @@ From the web console, you can now **subscribe to events** available from the HPE
284
274
285
275
Select your webhook from the list and select Subscribe to event. Select the source Service manager (there is only HPE GreenLake Platform for now), then cut/paste the event name from the [event catalog](https://developer.greenlake.hpe.com/docs/greenlake/services/#event-catalog). For example:
0 commit comments