Create a new webhook subscription for a specific project
JSON
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
POST: /api/management/projects/movies/events/webhooks/subscriptions/
{
"name": "name",
"description": "some description",
// Urls can be templated
"url": "https://external.mywebsite.com/handlewebhooks/{/resource/sys.id}",
"enabled": true,
"method": "POST",
"topics": [
{
"resourceType": "entry",
"event": ["updated", "created"],
"language": ["fr-fr"],
"contentTypeId": ["blog", "news"],
"owner": "t.durden"
},
{
"resourceType": "entry",
"event": ["published"],
"contentTypeId": ["news"],
"owner": "t.durden"
},
{
"resourceType": "contentType",
"event": ["created"]
},
{
"resourceType": "entry",
"event": ["workflowEventRaised"],
"contentTypeId": ["blog"],
"owner": "t.durden",
"workflowEvent" : ["contensisentrybasic.draft.submit", "contensisentryapproval.awaitingApproval.approve"]
},
{
"resourceType": "entry",
"event": ["workflowEventRaised"],
"contentTypeId": ["news"],
"owner": "t.durden",
"workflowEvent" : ["contensisentryapproval.awaitingApproval.declined"]
},
{
"resourceType": "entry",
"event": ["workflowStateChanged"],
"contentTypeId": ["blog"],
"owner": "t.durden",
"workflowState" : ["contensisentryapproval.awaitingApproval"]
}
],
"headers": {
"target": {
"value": "internal"
},
// Headers can be templated
"department": {
"value": "{/resource/department}"
},
// Headers can be specified as secret, which means that the value can be set but won't be returned
// Set
"secretHeaderSet": {
"secret": true,
"value": "cs7vdsdvj~8"
},
// Get
"secretHeaderGet": {
"value": "********",
"secret": true
}
// NOTE: A header will not be returned if it has no value
},
"templates": {
// For entry events return a custom structure with specific pieces of data
"entry": "{\n\"event\": \"{/event/name}\",\n\"user\": \"{/user/firstname} {/user/lastname}\",\n\"id\": \"{/resource/sys/id}\",\n\"title\": \"{/resource/entryTitle}\",\n\"description\": \"{/resource/entryDescription}\",\n\"department\": \"{/resource/department}\"}",
// A news specific template
"entry.news": "{\n\"event\": \"{/event/name}\",\n\"id\": \"{/resource/sys/id}\",\n\"title\": \"{/resource/entryTitle}\",\n\"headline\": \"{/resource/headline}\"}",
// For content type events return the entire content type resource (root)
"contentType": "{/resource/}"
// For all other events if a template for a resource is not supplied then return the default webhook request structure
}
}