forked from w3c/w3c-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebhooks.html
120 lines (111 loc) · 3.9 KB
/
webhooks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Webhooks</title>
<link rel="stylesheet" type="text/css" href="style/base.css"/>
<h1>Webhooks</h1>
<section>
<p>
Webhooks allow you to subscribe to certain events happening at W3C. When one of these events is triggered, we'll
send a HTTP POST payload to the webhook's configured URL.
</p>
<p>
You can configure your webhooks from <a href="https://www.w3.org/users/myprofile/webhooks">your profile</a>.
</p>
</section>
<section>
<h2>Events</h2>
<p>
When configuring a webhook, you can choose which events you would like to receive payloads for. You can change
the subscribed events through the UI anytime.
</p>
<p>
Each event corresponds to a certain set of actions that can happen. For
example, if you subscribe to the publication event you'll receive detailed payloads every time a technical
report
is published.
</p>
<p>The available events are:</p>
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td>Publication (tr.published, tr.updated)</td>
<td>Any time a technical report is published or its metadata are updated</td>
</tr>
<tr>
<td>Group Participation (group.participant_joined, group.participant_left)</td>
<td>Any time someone joins or leaves a group</td>
</tr>
<tr>
<td>Connected Accounts (connected_account.created, connected_account.deleted)</td>
<td>Any time someone connects their W3C account to an external service such as GitHub, or removes such a connection</td>
</tr>
</table>
<p>This list of events will be progressively augmented.</p>
</section>
<section>
<h2>Headers and Payloads</h2>
<p>HTTP requests made to your webhook's configured URL endpoint will contain several special headers:</p>
<table>
<tr>
<th>Header</th>
<th>Description</th>
</tr>
<tr>
<td>X-W3C-Webhook</td>
<td>Link to the webhook that triggered the delivery</td>
</tr>
<tr>
<td>X-W3C-Webhook-Id</td>
<td>ID of the webhook that triggered the delivery</td>
</tr>
</table>
<p>
Payload of HTTP requests consists in a JSON fragment including the event that triggered the webhook and one or
several
objects serialized in the same way as the <a href="https://api.w3.org/doc">API</a>.
</p>
<h3>Example delivery</h3>
<pre>
URL: http://example.org/my-webhook
Host: example.org
X-W3C-Webhook: https://www.w3.org/users/12345/webhooks/1
X-W3C-Webhook-Id: 1
</pre>
<pre>
{
"event": "tr.published",
"specVersion": {
"status": "Working Draft",
"uri": "http:\/\/www.w3.org\/TR\/2016\/WD-preload-20160120\/",
"date": "2016-01-20",
"informative": false,
"title": "Preload",
"shortlink": "http:\/\/www.w3.org\/TR\/preload\/",
"editor_draft": "http:\/\/w3c.github.io\/preload\/",
"process_rules": "http:\/\/www.w3.org\/2015\/Process-20150901\/",
"_links": {
"self": {
"href": "https:\/\/api.w3.org\/specifications\/preload\/versions\/20160120"
},
"editors": {
"href": "https:\/\/api.w3.org\/specifications\/preload\/versions\/20160120\/editors"
},
"deliverers": {
"href": "https:\/\/api.w3.org\/specifications\/preload\/versions\/20160120\/deliverers"
},
"specification": {
"href": "https:\/\/api.w3.org\/specifications\/preload"
},
"predecessor-version": {
"href": "https:\/\/api.w3.org\/specifications\/preload\/versions\/20160120\/predecessors"
}
}
}
}
</pre>
</section>
</html>