@pipedream/zendesk 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/common/constants.mjs +29 -0
- package/package.json +21 -0
- package/sources/common/base.mjs +182 -0
- package/sources/common/ticket.mjs +21 -0
- package/sources/new-ticket/new-ticket.mjs +30 -0
- package/sources/ticket-closed/ticket-closed.mjs +35 -0
- package/sources/ticket-pended/ticket-pended.mjs +35 -0
- package/sources/ticket-solved/ticket-solved.mjs +35 -0
- package/zendesk.app.mjs +139 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2020 Pipedream, Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const SUBDOMAIN_PLACEHOLDER = "{subdomain}";
|
|
2
|
+
const BASE_URL = `https://${SUBDOMAIN_PLACEHOLDER}.zendesk.com`;
|
|
3
|
+
const VERSION_PATH = "/api/v2";
|
|
4
|
+
const WEBHOOK_ID = "webhookId";
|
|
5
|
+
const TRIGGER_ID = "triggerId";
|
|
6
|
+
const PAGE_SIZE_PARAM = "page[size]";
|
|
7
|
+
const PAGE_AFTER_PARAM = "page[after]";
|
|
8
|
+
const SORT_BY_POSITION_ASC = "position";
|
|
9
|
+
const X_ZENDESK_WEBHOOK_SIGNATURE_HEADER = "x-zendesk-webhook-signature";
|
|
10
|
+
const X_ZENDESK_WEBHOOK_SIGNATURE_TIMESTAMP_HEADER = "x-zendesk-webhook-signature-timestamp";
|
|
11
|
+
const SIGNING_SECRET = "signingSecret";
|
|
12
|
+
const SIGNING_SECRET_ALGORITHM = "sha256";
|
|
13
|
+
const BASE_64 = "base64";
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
SUBDOMAIN_PLACEHOLDER,
|
|
17
|
+
BASE_URL,
|
|
18
|
+
VERSION_PATH,
|
|
19
|
+
WEBHOOK_ID,
|
|
20
|
+
TRIGGER_ID,
|
|
21
|
+
PAGE_SIZE_PARAM,
|
|
22
|
+
PAGE_AFTER_PARAM,
|
|
23
|
+
SORT_BY_POSITION_ASC,
|
|
24
|
+
X_ZENDESK_WEBHOOK_SIGNATURE_HEADER,
|
|
25
|
+
X_ZENDESK_WEBHOOK_SIGNATURE_TIMESTAMP_HEADER,
|
|
26
|
+
SIGNING_SECRET,
|
|
27
|
+
SIGNING_SECRET_ALGORITHM,
|
|
28
|
+
BASE_64,
|
|
29
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipedream/zendesk",
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"description": "Pipedream Zendesk Components",
|
|
5
|
+
"main": "zendesk.app.mjs",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pipedream",
|
|
8
|
+
"zendesk"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://pipedream.com/apps/zendesk",
|
|
11
|
+
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@pipedream/platform": "^0.9.0",
|
|
19
|
+
"crypto": "^1.0.1"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
2
|
+
import zendesk from "../../zendesk.app.mjs";
|
|
3
|
+
import constants from "../../common/constants.mjs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
props: {
|
|
7
|
+
zendesk,
|
|
8
|
+
db: "$.service.db",
|
|
9
|
+
http: "$.interface.http",
|
|
10
|
+
categoryId: {
|
|
11
|
+
propDefinition: [
|
|
12
|
+
zendesk,
|
|
13
|
+
"categoryId",
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
hooks: {
|
|
18
|
+
async activate() {
|
|
19
|
+
const { categoryId } = this;
|
|
20
|
+
|
|
21
|
+
const { webhook } = await this.zendesk.createWebhook({
|
|
22
|
+
data: this.setupWebhookData(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { id: webhookId } = webhook;
|
|
26
|
+
this.setWebhookId(webhookId);
|
|
27
|
+
|
|
28
|
+
const { signing_secret: signingSecret } = await this.zendesk.showWebhookSigningSecret({
|
|
29
|
+
webhookId,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const { secret } = signingSecret;
|
|
33
|
+
this.setSigningSecret(secret);
|
|
34
|
+
|
|
35
|
+
const { trigger } = await this.zendesk.createTrigger({
|
|
36
|
+
data: this.setupTriggerData({
|
|
37
|
+
webhookId,
|
|
38
|
+
categoryId,
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const { id: triggerId } = trigger;
|
|
43
|
+
this.setTriggerId(String(triggerId));
|
|
44
|
+
},
|
|
45
|
+
async deactivate() {
|
|
46
|
+
await Promise.all([
|
|
47
|
+
this.zendesk.deleteTrigger({
|
|
48
|
+
triggerId: this.getTriggerId(),
|
|
49
|
+
}),
|
|
50
|
+
this.zendesk.deleteWebhook({
|
|
51
|
+
webhookId: this.getWebhookId(),
|
|
52
|
+
}),
|
|
53
|
+
]);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
setWebhookId(webhookId) {
|
|
58
|
+
this.db.set(constants.WEBHOOK_ID, webhookId);
|
|
59
|
+
},
|
|
60
|
+
getWebhookId() {
|
|
61
|
+
return this.db.get(constants.WEBHOOK_ID);
|
|
62
|
+
},
|
|
63
|
+
setTriggerId(triggerId) {
|
|
64
|
+
this.db.set(constants.TRIGGER_ID, triggerId);
|
|
65
|
+
},
|
|
66
|
+
getTriggerId() {
|
|
67
|
+
return this.db.get(constants.TRIGGER_ID);
|
|
68
|
+
},
|
|
69
|
+
setSigningSecret(secret) {
|
|
70
|
+
return this.db.set(constants.SIGNING_SECRET, secret);
|
|
71
|
+
},
|
|
72
|
+
getSigningSecret() {
|
|
73
|
+
return this.db.get(constants.SIGNING_SECRET);
|
|
74
|
+
},
|
|
75
|
+
getWebhookName() {
|
|
76
|
+
throw new Error("getWebhookName is not implemented");
|
|
77
|
+
},
|
|
78
|
+
getTriggerTitle() {
|
|
79
|
+
throw new Error("getTriggerTitle is not implemented");
|
|
80
|
+
},
|
|
81
|
+
/**
|
|
82
|
+
* If you want to use this function, you need to implement it in your component.
|
|
83
|
+
* setupTriggerData depends on this function.
|
|
84
|
+
* https://developer.zendesk.com/documentation/ticketing/reference-guides/conditions-reference/
|
|
85
|
+
*/
|
|
86
|
+
getTriggerConditions() {
|
|
87
|
+
throw new Error("getTriggerConditions is not implemented");
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* If you want to use this function, you need to implement it in your component.
|
|
91
|
+
* setupTriggerData depends on this function.
|
|
92
|
+
* https://developer.zendesk.com/api-reference/ticketing/ticket-management/dynamic_content/
|
|
93
|
+
*/
|
|
94
|
+
getTriggerPayload() {
|
|
95
|
+
throw new Error("getTriggerPayload is not implemented");
|
|
96
|
+
},
|
|
97
|
+
setupWebhookData() {
|
|
98
|
+
return {
|
|
99
|
+
webhook: {
|
|
100
|
+
endpoint: this.http.endpoint,
|
|
101
|
+
http_method: "POST",
|
|
102
|
+
name: this.getWebhookName(),
|
|
103
|
+
status: "active",
|
|
104
|
+
request_format: "json",
|
|
105
|
+
subscriptions: [
|
|
106
|
+
"conditional_ticket_events",
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
setupTriggerData({
|
|
112
|
+
webhookId, categoryId,
|
|
113
|
+
}) {
|
|
114
|
+
return {
|
|
115
|
+
trigger: {
|
|
116
|
+
title: this.getTriggerTitle(),
|
|
117
|
+
category_id: categoryId,
|
|
118
|
+
conditions: this.getTriggerConditions(),
|
|
119
|
+
actions: [
|
|
120
|
+
{
|
|
121
|
+
field: "notification_webhook",
|
|
122
|
+
value: [
|
|
123
|
+
webhookId,
|
|
124
|
+
JSON.stringify(this.getTriggerPayload()),
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
isValidSource({
|
|
132
|
+
signature, bodyRaw, timestamp,
|
|
133
|
+
}) {
|
|
134
|
+
const secret = this.getSigningSecret();
|
|
135
|
+
|
|
136
|
+
const sig =
|
|
137
|
+
crypto
|
|
138
|
+
.createHmac(constants.SIGNING_SECRET_ALGORITHM, secret)
|
|
139
|
+
.update(timestamp + bodyRaw)
|
|
140
|
+
.digest(constants.BASE_64);
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
Buffer.compare(
|
|
144
|
+
Buffer.from(signature),
|
|
145
|
+
Buffer.from(sig.toString(constants.BASE_64)),
|
|
146
|
+
) === 0
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
async run(event) {
|
|
151
|
+
const {
|
|
152
|
+
body: payload,
|
|
153
|
+
headers,
|
|
154
|
+
bodyRaw,
|
|
155
|
+
} = event;
|
|
156
|
+
|
|
157
|
+
const {
|
|
158
|
+
[constants.X_ZENDESK_WEBHOOK_SIGNATURE_HEADER]: signature,
|
|
159
|
+
[constants.X_ZENDESK_WEBHOOK_SIGNATURE_TIMESTAMP_HEADER]: timestamp,
|
|
160
|
+
} = headers;
|
|
161
|
+
|
|
162
|
+
const isValid = this.isValidSource({
|
|
163
|
+
signature,
|
|
164
|
+
bodyRaw,
|
|
165
|
+
timestamp,
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if (!isValid) {
|
|
169
|
+
console.log("Skipping event due to invalid signature");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const ts = Date.parse(payload.updatedAt);
|
|
174
|
+
const id = `${payload.ticketId}-${ts}`;
|
|
175
|
+
|
|
176
|
+
this.$emit(payload, {
|
|
177
|
+
id,
|
|
178
|
+
summary: payload.title,
|
|
179
|
+
ts,
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import common from "./base.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
methods: {
|
|
6
|
+
...common.methods,
|
|
7
|
+
getTriggerPayload() {
|
|
8
|
+
return {
|
|
9
|
+
ticketId: "{{ticket.id}}",
|
|
10
|
+
title: "{{ticket.title}}",
|
|
11
|
+
description: "{{ticket.description}}",
|
|
12
|
+
url: "{{ticket.url}}",
|
|
13
|
+
requester: "{{ticket.requester.first_name}} {{ticket.requester.last_name}} <{{ticket.requester.email}}>",
|
|
14
|
+
assignee: "{{ticket.assignee.first_name}} {{ticket.assignee.last_name}} <{{ticket.assignee.email}}>",
|
|
15
|
+
status: "{{ticket.status}}",
|
|
16
|
+
createdAt: "{{ticket.created_at_with_timestamp}}",
|
|
17
|
+
updatedAt: "{{ticket.updated_at_with_timestamp}}",
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import common from "../common/ticket.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
name: "New Ticket (Instant)",
|
|
6
|
+
key: "zendesk-new-ticket",
|
|
7
|
+
type: "source",
|
|
8
|
+
description: "Emit new event when a ticket is created",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getWebhookName() {
|
|
14
|
+
return "New Ticket Webhook";
|
|
15
|
+
},
|
|
16
|
+
getTriggerTitle() {
|
|
17
|
+
return "New Ticket Trigger";
|
|
18
|
+
},
|
|
19
|
+
getTriggerConditions() {
|
|
20
|
+
return {
|
|
21
|
+
all: [
|
|
22
|
+
{
|
|
23
|
+
field: "update_type",
|
|
24
|
+
value: "Create",
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import common from "../common/ticket.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
name: "Ticket Closed (Instant)",
|
|
6
|
+
key: "zendesk-ticket-closed",
|
|
7
|
+
type: "source",
|
|
8
|
+
description: "Emit new event when a ticket has changed to closed status",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getWebhookName() {
|
|
14
|
+
return "Ticket Closed Webhook";
|
|
15
|
+
},
|
|
16
|
+
getTriggerTitle() {
|
|
17
|
+
return "Ticket Closed Trigger";
|
|
18
|
+
},
|
|
19
|
+
getTriggerConditions() {
|
|
20
|
+
return {
|
|
21
|
+
all: [
|
|
22
|
+
{
|
|
23
|
+
field: "update_type",
|
|
24
|
+
value: "Change",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
field: "status",
|
|
28
|
+
operator: "value",
|
|
29
|
+
value: "closed",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import common from "../common/ticket.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
name: "Ticket Pended (Instant)",
|
|
6
|
+
key: "zendesk-ticket-pended",
|
|
7
|
+
type: "source",
|
|
8
|
+
description: "Emit new event when a ticket has changed to pending status",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getWebhookName() {
|
|
14
|
+
return "Ticket Pended Webhook";
|
|
15
|
+
},
|
|
16
|
+
getTriggerTitle() {
|
|
17
|
+
return "Ticket Pended Trigger";
|
|
18
|
+
},
|
|
19
|
+
getTriggerConditions() {
|
|
20
|
+
return {
|
|
21
|
+
all: [
|
|
22
|
+
{
|
|
23
|
+
field: "update_type",
|
|
24
|
+
value: "Change",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
field: "status",
|
|
28
|
+
operator: "value",
|
|
29
|
+
value: "pending",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import common from "../common/ticket.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
...common,
|
|
5
|
+
name: "Ticket Solved (Instant)",
|
|
6
|
+
key: "zendesk-ticket-solved",
|
|
7
|
+
type: "source",
|
|
8
|
+
description: "Emit new event when a ticket has changed to solved status",
|
|
9
|
+
version: "0.0.2",
|
|
10
|
+
dedupe: "unique",
|
|
11
|
+
methods: {
|
|
12
|
+
...common.methods,
|
|
13
|
+
getWebhookName() {
|
|
14
|
+
return "Ticket Solved Webhook";
|
|
15
|
+
},
|
|
16
|
+
getTriggerTitle() {
|
|
17
|
+
return "Ticket Solved Trigger";
|
|
18
|
+
},
|
|
19
|
+
getTriggerConditions() {
|
|
20
|
+
return {
|
|
21
|
+
all: [
|
|
22
|
+
{
|
|
23
|
+
field: "update_type",
|
|
24
|
+
value: "Change",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
field: "status",
|
|
28
|
+
operator: "value",
|
|
29
|
+
value: "solved",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
package/zendesk.app.mjs
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { axios } from "@pipedream/platform";
|
|
2
|
+
import constants from "./common/constants.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
type: "app",
|
|
6
|
+
app: "zendesk",
|
|
7
|
+
propDefinitions: {
|
|
8
|
+
categoryId: {
|
|
9
|
+
type: "string",
|
|
10
|
+
label: "Trigger category ID",
|
|
11
|
+
description: "The ID of the trigger category. [See the docs here](https://developer.zendesk.com/api-reference/ticketing/business-rules/trigger_categories/#list-trigger-categories)",
|
|
12
|
+
async options({ prevContext }) {
|
|
13
|
+
const { afterCursor } = prevContext;
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
trigger_categories: categories,
|
|
17
|
+
meta,
|
|
18
|
+
} =
|
|
19
|
+
await this.listTriggerCategories({
|
|
20
|
+
params: {
|
|
21
|
+
[constants.PAGE_SIZE_PARAM]: 20,
|
|
22
|
+
sort: constants.SORT_BY_POSITION_ASC,
|
|
23
|
+
[constants.PAGE_AFTER_PARAM]: afterCursor,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
context: {
|
|
29
|
+
afterCursor: meta.after_cursor,
|
|
30
|
+
},
|
|
31
|
+
options: categories.map(({
|
|
32
|
+
id, name,
|
|
33
|
+
}) => ({
|
|
34
|
+
label: name,
|
|
35
|
+
value: id,
|
|
36
|
+
})),
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
getApiUrl({
|
|
43
|
+
path, subdomain,
|
|
44
|
+
}) {
|
|
45
|
+
const {
|
|
46
|
+
SUBDOMAIN_PLACEHOLDER,
|
|
47
|
+
BASE_URL,
|
|
48
|
+
VERSION_PATH,
|
|
49
|
+
} = constants;
|
|
50
|
+
return `${BASE_URL.replace(SUBDOMAIN_PLACEHOLDER, subdomain)}${VERSION_PATH}${path}`;
|
|
51
|
+
},
|
|
52
|
+
async makeRequest(customConfig) {
|
|
53
|
+
const {
|
|
54
|
+
$,
|
|
55
|
+
url,
|
|
56
|
+
path,
|
|
57
|
+
...configProps
|
|
58
|
+
} = customConfig;
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
oauth_access_token: oauthAccessToken,
|
|
62
|
+
subdomain,
|
|
63
|
+
} = this.$auth;
|
|
64
|
+
|
|
65
|
+
const headers = {
|
|
66
|
+
...configProps?.headers,
|
|
67
|
+
authorization: `Bearer ${oauthAccessToken}`,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const config = {
|
|
71
|
+
...configProps,
|
|
72
|
+
headers,
|
|
73
|
+
url: url ?? this.getApiUrl({
|
|
74
|
+
subdomain,
|
|
75
|
+
path,
|
|
76
|
+
}),
|
|
77
|
+
timeout: 10000,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return axios($ ?? this, config);
|
|
81
|
+
},
|
|
82
|
+
async createTrigger({
|
|
83
|
+
$, data,
|
|
84
|
+
}) {
|
|
85
|
+
return this.makeRequest({
|
|
86
|
+
$,
|
|
87
|
+
method: "post",
|
|
88
|
+
path: "/triggers",
|
|
89
|
+
data,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
async deleteTrigger({
|
|
93
|
+
$, triggerId,
|
|
94
|
+
}) {
|
|
95
|
+
return this.makeRequest({
|
|
96
|
+
$,
|
|
97
|
+
method: "delete",
|
|
98
|
+
path: `/triggers/${triggerId}`,
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
async listTriggerCategories({
|
|
102
|
+
$, url, params,
|
|
103
|
+
}) {
|
|
104
|
+
return this.makeRequest({
|
|
105
|
+
$,
|
|
106
|
+
url,
|
|
107
|
+
path: "/trigger_categories",
|
|
108
|
+
params,
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
async createWebhook({
|
|
112
|
+
$, data,
|
|
113
|
+
}) {
|
|
114
|
+
return this.makeRequest({
|
|
115
|
+
$,
|
|
116
|
+
method: "post",
|
|
117
|
+
path: "/webhooks",
|
|
118
|
+
data,
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
async deleteWebhook({
|
|
122
|
+
$, webhookId,
|
|
123
|
+
}) {
|
|
124
|
+
return this.makeRequest({
|
|
125
|
+
$,
|
|
126
|
+
method: "delete",
|
|
127
|
+
path: `/webhooks/${webhookId}`,
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
async showWebhookSigningSecret({
|
|
131
|
+
$, webhookId,
|
|
132
|
+
}) {
|
|
133
|
+
return this.makeRequest({
|
|
134
|
+
$,
|
|
135
|
+
path: `/webhooks/${webhookId}/signing_secret`,
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
};
|