@activepieces/piece-zendesk 0.0.1 → 0.0.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/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-zendesk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@sinclair/typebox": "0.26.
|
|
5
|
+
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"axios": "1.2.4",
|
|
7
7
|
"nanoid": "3.3.4",
|
|
8
|
-
"@activepieces/framework": "0.3.
|
|
9
|
-
"@activepieces/shared": "0.3.
|
|
8
|
+
"@activepieces/pieces-framework": "0.3.13",
|
|
9
|
+
"@activepieces/shared": "0.3.11",
|
|
10
|
+
"@activepieces/pieces-common": "0.0.1",
|
|
10
11
|
"tslib": "2.4.1"
|
|
11
12
|
},
|
|
12
13
|
"main": "./src/index.js",
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const zendesk: import("@activepieces/framework").Piece;
|
|
1
|
+
export declare const zendesk: import("@activepieces/pieces-framework").Piece;
|
package/src/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.zendesk = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
7
7
|
const new_ticket_in_view_1 = require("./lib/trigger/new-ticket-in-view");
|
|
8
|
-
exports.zendesk = (0,
|
|
8
|
+
exports.zendesk = (0, pieces_framework_1.createPiece)({
|
|
9
9
|
name: 'zendesk',
|
|
10
10
|
displayName: 'Zendesk',
|
|
11
11
|
logoUrl: 'https://cdn.activepieces.com/pieces/zendesk.png',
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/zendesk/src/index.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/zendesk/src/index.ts"],"names":[],"mappings":";;;;AACA,qEAA6D;AAC7D,2EAA0C;AAC1C,yEAAmE;AAEtD,QAAA,OAAO,GAAG,IAAA,8BAAW,EAAC;IACjC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,iDAAiD;IAC1D,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC5B,OAAO,EAAE;QACP,UAAU;KACX;IACD,OAAO,EAAE,EACR;IACD,QAAQ,EAAE;QACR,oCAAe;KAChB;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const newTicketInView: import("@activepieces/framework").Trigger;
|
|
1
|
+
export declare const newTicketInView: import("@activepieces/pieces-framework").Trigger;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newTicketInView = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const markdownProperty = `
|
|
8
8
|
**Organization**: The organization name can be found in the URL (e.g https://ORGANIZATION_NAME.zendesk.com).
|
|
9
9
|
|
|
@@ -11,27 +11,27 @@ const markdownProperty = `
|
|
|
11
11
|
|
|
12
12
|
**API Token**: You can find this in the Zendesk Admin Panel under Settings > APIs > Zendesk API.
|
|
13
13
|
`;
|
|
14
|
-
exports.newTicketInView = (0,
|
|
14
|
+
exports.newTicketInView = (0, pieces_framework_1.createTrigger)({
|
|
15
15
|
name: 'new_ticket_in_view',
|
|
16
16
|
displayName: 'New ticket in view',
|
|
17
17
|
description: 'Triggers when a new ticket is created in a view',
|
|
18
|
-
type:
|
|
18
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
19
19
|
props: {
|
|
20
|
-
authentication:
|
|
20
|
+
authentication: pieces_framework_1.Property.CustomAuth({
|
|
21
21
|
displayName: 'Authentication',
|
|
22
22
|
description: markdownProperty,
|
|
23
23
|
props: {
|
|
24
|
-
email:
|
|
24
|
+
email: pieces_framework_1.Property.ShortText({
|
|
25
25
|
displayName: 'Agent Email',
|
|
26
26
|
description: 'The email address you use to login to Zendesk',
|
|
27
27
|
required: true,
|
|
28
28
|
}),
|
|
29
|
-
token:
|
|
29
|
+
token: pieces_framework_1.Property.ShortText({
|
|
30
30
|
displayName: 'Token',
|
|
31
31
|
description: 'The API token you can generate in Zendesk',
|
|
32
32
|
required: true,
|
|
33
33
|
}),
|
|
34
|
-
subdomain:
|
|
34
|
+
subdomain: pieces_framework_1.Property.ShortText({
|
|
35
35
|
displayName: 'Organization (e.g activepieceshelp)',
|
|
36
36
|
description: 'The subdomain of your Zendesk instance',
|
|
37
37
|
required: true,
|
|
@@ -39,7 +39,7 @@ exports.newTicketInView = (0, framework_1.createTrigger)({
|
|
|
39
39
|
},
|
|
40
40
|
required: true,
|
|
41
41
|
}),
|
|
42
|
-
view_id:
|
|
42
|
+
view_id: pieces_framework_1.Property.Dropdown({
|
|
43
43
|
displayName: 'View',
|
|
44
44
|
description: 'The view to monitor for new tickets',
|
|
45
45
|
refreshers: ['authentication'],
|
|
@@ -53,11 +53,11 @@ exports.newTicketInView = (0, framework_1.createTrigger)({
|
|
|
53
53
|
options: [],
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
const response = yield
|
|
56
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
57
57
|
url: `https://${authentication.subdomain}.zendesk.com/api/v2/views.json`,
|
|
58
|
-
method:
|
|
58
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
59
59
|
authentication: {
|
|
60
|
-
type:
|
|
60
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
61
61
|
username: authentication.email + "/token",
|
|
62
62
|
password: authentication.token,
|
|
63
63
|
}
|
|
@@ -120,32 +120,32 @@ exports.newTicketInView = (0, framework_1.createTrigger)({
|
|
|
120
120
|
"from_messaging_channel": false
|
|
121
121
|
},
|
|
122
122
|
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
yield
|
|
123
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
124
124
|
store: context.store,
|
|
125
125
|
propsValue: context.propsValue,
|
|
126
126
|
});
|
|
127
127
|
}),
|
|
128
128
|
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
-
yield
|
|
129
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
130
130
|
store: context.store,
|
|
131
131
|
propsValue: context.propsValue,
|
|
132
132
|
});
|
|
133
133
|
}),
|
|
134
134
|
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
135
|
-
return yield
|
|
135
|
+
return yield pieces_common_1.pollingHelper.poll(polling, {
|
|
136
136
|
store: context.store,
|
|
137
137
|
propsValue: context.propsValue,
|
|
138
138
|
});
|
|
139
139
|
}),
|
|
140
140
|
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
-
return yield
|
|
141
|
+
return yield pieces_common_1.pollingHelper.poll(polling, {
|
|
142
142
|
store: context.store,
|
|
143
143
|
propsValue: context.propsValue,
|
|
144
144
|
});
|
|
145
145
|
})
|
|
146
146
|
});
|
|
147
147
|
const polling = {
|
|
148
|
-
strategy:
|
|
148
|
+
strategy: pieces_common_1.DedupeStrategy.LAST_ITEM,
|
|
149
149
|
items: ({ propsValue }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
150
150
|
const items = yield getTickets(propsValue.authentication, propsValue.view_id);
|
|
151
151
|
return items.map((item) => ({
|
|
@@ -157,11 +157,11 @@ const polling = {
|
|
|
157
157
|
function getTickets(authentication, view_id) {
|
|
158
158
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
159
159
|
const { email, token, subdomain } = authentication;
|
|
160
|
-
const response = yield
|
|
160
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
161
161
|
url: `https://${subdomain}.zendesk.com/api/v2/views/${view_id}/tickets.json?sort_order=desc&sort_by=created_at&per_page=200`,
|
|
162
|
-
method:
|
|
162
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
163
163
|
authentication: {
|
|
164
|
-
type:
|
|
164
|
+
type: pieces_common_1.AuthenticationType.BASIC,
|
|
165
165
|
username: email + "/token",
|
|
166
166
|
password: token,
|
|
167
167
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-ticket-in-view.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/zendesk/src/lib/trigger/new-ticket-in-view.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"new-ticket-in-view.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/zendesk/src/lib/trigger/new-ticket-in-view.ts"],"names":[],"mappings":";;;;AAAA,qEAA2F;AAC3F,+DAAiI;AAEjI,MAAM,gBAAgB,GAAG;;;;;;CAMxB,CAAA;AAEY,QAAA,eAAe,GAAG,IAAA,gCAAa,EAAC;IACzC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,iDAAiD;IAC9D,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACH,cAAc,EAAE,2BAAQ,CAAC,UAAU,CAAC;YAChC,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EAAE,gBAAgB;YAC7B,KAAK,EAAE;gBACH,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACtB,WAAW,EAAE,aAAa;o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