Skip to content

Commit 0535152

Browse files
Merge pull request #5506 from Sachin-Mamoru/webhook-doc-update2
Added missing webhook events payload documentation
2 parents 1a7b561 + b2249c9 commit 0535152

File tree

2 files changed

+477
-23
lines changed

2 files changed

+477
-23
lines changed

en/includes/guides/webhooks/setup-webhooks.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Setup webhooks {% if product_name == "Asgardeo" %}<div class="md-chip md-chip--preview">
2-
3-
<span class="md-chip__label">Preview</span></div>{% endif %}
1+
# Setup webhooks {% if product_name == "Asgardeo" %}<div class="md-chip md-chip--preview"><span class="md-chip__label">Preview</span></div>{% endif %}
42

53
This guide provides a step-by-step approach to setting up webhooks in {{product_name}} to integrate external systems.
64

@@ -21,10 +19,13 @@ Ensure that you have:
2119

2220
Your external web service should do the following to receive event notifications:
2321

24-
1. Expose an endpoint that accepts both HTTP GET and POST requests with JSON payloads.
2522
{% if product_name == "Asgardeo" %}
23+
24+
1. Expose an endpoint that accepts both HTTP GET and POST requests with JSON payloads.
2625
{{product_name}} sends GET requests for subscription and unsubscription verification.
2726
Your endpoint must respond to these GET requests with the <code>hub.challenge</code> string to confirm its readiness to receive events.
27+
{% else %}
28+
1. Expose an endpoint that accepts HTTP POST requests with JSON payloads.
2829
{% endif %}
2930
{{product_name}} sends POST requests to deliver the actual event notifications. These requests contain the event payload in JSON format.
3031

@@ -99,7 +100,7 @@ This process adheres to the [WebSub specification](https://www.w3.org/TR/2018/RE
99100

100101
## Receive webhook events
101102

102-
{{product_name}} sends an HTTP POST request to your webhook endpoint when a subscribed event is triggered. This request contains a JSON message with event details. Your service can then parse and use this information as needed.
103+
{{product_name}} sends an HTTP POST request to your webhook endpoint when a subscribed event is triggered. This request contains a JSON message with event details. Your service can then use this information as needed.
103104

104105
### Event payload structure
105106

@@ -118,7 +119,7 @@ Webhook event payloads adhere to the [Security Event Token (SET) specification (
118119
```http
119120
POST /your-webhook-endpoint
120121
Content-Type: application/json
121-
X-Hub-Signature: sha256=abcdef12345... (HMAC signature)
122+
x-hub-signature: sha256=abcdef12345... (HMAC signature)
122123
123124
{
124125
"iss": "https://api.asgardeo.io/t/myorg",
@@ -129,6 +130,12 @@ X-Hub-Signature: sha256=abcdef12345... (HMAC signature)
129130
"https://schemas.identity.wso2.org/events/login/event-type/loginSuccess": {
130131
"user": {
131132
"id": "d4002616-f00c-49d5-b9b7-63b063819049",
133+
"claims": [
134+
{
135+
"uri": "http://wso2.org/claims/username",
136+
"value": "[email protected]"
137+
}
138+
],
132139
"organization": {
133140
"id": "6f8d17ae-1ad5-441b-b9e0-c7731e739e94",
134141
"name": "myorg",
@@ -168,7 +175,7 @@ X-Hub-Signature: sha256=abcdef12345... (HMAC signature)
168175
```http
169176
POST /your-webhook-endpoint
170177
Content-Type: application/json
171-
X-Hub-Signature: sha256=abcdef12345... (HMAC signature)
178+
x-wso2-event-signature: sha256=abcdef12345... (HMAC signature)
172179
173180
{
174181
"iss": "https://localhost:9443/t/myorg.com",
@@ -179,6 +186,12 @@ X-Hub-Signature: sha256=abcdef12345... (HMAC signature)
179186
"https://schemas.identity.wso2.org/events/login/event-type/loginSuccess": {
180187
"user": {
181188
"id": "d4002616-f00c-49d5-b9b7-63b063819049",
189+
"claims": [
190+
{
191+
"uri": "http://wso2.org/claims/username",
192+
"value": "[email protected]"
193+
}
194+
],
182195
"organization": {
183196
"id": "6f8d17ae-1ad5-441b-b9e0-c7731e739e94",
184197
"name": "myorg",
@@ -265,7 +278,7 @@ If your webhook isn't functioning as expected, consider the following common iss
265278
- Verify that your webhook endpoint is online, running, and publicly accessible to {{product_name}}. Tools like <code>curl</code> or online HTTP testing services can help check external reachability.
266279
- Check your endpoint's server logs for incoming GET requests from {{product_name}}. Configure your endpoint to read the <code>hub.challenge</code> query parameter and respond with a <code>2xx</code> HTTP status code, returning the exact <code>hub.challenge</code> string in the response body. {{product_name}} delivers events only after a successful subscription.
267280
- Ensure that no firewalls, security groups, or network ACLs are blocking incoming connections from [{{product_name}}'s IP ranges]({{base_path}}/references/asgardeo-outbound-ip-addresses/).
268-
- If your endpoint receives the request but doesn't process it, there might be an issue with your code parsing the JSON payload or handling the <code>X-Hub-Signature</code> header. Review your application logs for errors.
281+
- If your endpoint receives the request but doesn't process it, there might be an issue with your code parsing the JSON payload or handling the <code>x-hub-signature</code> header. Review your application logs for errors.
269282
- {{product_name}} retries failed deliveries. Consistent failures show a persistent issue with your endpoint. Look at addressing them.
270283

271284
3. **Event signature (HMAC) mismatch**
@@ -351,7 +364,7 @@ Follow these guidelines to ensure your webhook implementation remains resilient
351364

352365
Events might also apply to different resources under the same event type. For example, *credential updated events* currently happen for password updates, indicated by the <code>credentialType</code> property in the payload. In the future, the same event could happen for passkeys, TOTP, or other credential types, introducing new values for <code>credentialType</code>. Design your logic to safely ignore or specifically handle new values for such properties if you only want particular resource updates (for example, only password updates).
353366

354-
3. Ensure graceful unknown property handling:
367+
3. Ensure graceful unknown property handling
355368
Avoid strict schema validation that would cause your webhook to fail if {{product_name}} adds new, optional properties to an existing event payload. Your parser should be able to ignore unrecognized properties, ensuring forward compatibility.
356369

357370
By following these practices, your webhook will be more adaptable to future enhancements in {{product_name}}'s event delivery, requiring fewer updates on your side to maintain functionality.

0 commit comments

Comments
 (0)