@pipedream/zendesk 0.6.1 → 0.7.1

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/README.md CHANGED
@@ -1,19 +1,94 @@
1
1
  # Overview
2
2
 
3
- Using the Zendesk API, you can build custom apps and integrations to automate
4
- processes and help your teams build better customer relationships.
5
-
6
- The API provides a range of methods to interact with your customer help desk,
7
- customer data, and customer communication tools. This enables you to create
8
- custom customer experiences that are tailored to your business needs.
9
-
10
- Some examples of what you can build using the Zendesk API include:
11
-
12
- - Create a custom customer feedback widget
13
- - Automate customer service processes
14
- - Identify customer trends and insights
15
- - Help manage customer data in real-time
16
- - Create a custom customer profile and segmentation tool
17
- - Trigger automated messages based on customer events
18
- - Integrate customer service processes with your company’s backend system
19
- - Create a custom customer self-service portal
3
+ The Zendesk API enables seamless integration of Zendesk's customer service platform with your existing business processes and third-party applications. By leveraging this API with Pipedream, you can automate ticket tracking, sync customer data, escalate issues, and streamline communication across multiple channels. This can significantly increase efficiency, accelerate response times, and enhance the overall customer experience. Automations can range from simple notifications to complex workflows involving data transformation and multi-step actions across various services.
4
+
5
+ # Example Use Cases
6
+
7
+ **Ticket Management Automation**
8
+ Automatically create Zendesk tickets from emails, chat messages, or form submissions captured in other apps like Gmail or Slack. Use Pipedream to parse the incoming information and create a ticket in Zendesk with the appropriate tags, priorities, and assignments.
9
+
10
+ **Customer Feedback Loop**
11
+ After a ticket is resolved, trigger a workflow to send a follow-up survey using a platform like Typeform. Record responses back in Zendesk to ensure customer feedback influences service quality. An automated workflow could tag the ticket with the feedback score or add notes for support agents.
12
+
13
+ **Real-Time Notifications for Critical Issues**
14
+ Set up a Pipedream workflow that monitors Zendesk for tickets with 'Urgent' priority or specific keywords and sends instant notifications to a dedicated Slack channel or via SMS through Twilio. This ensures that critical issues are promptly addressed by support teams.
15
+
16
+ # Getting Started
17
+
18
+ First, log in to your [Pipedream workspace](https://pipedream.com), then connect Zendesk either through a step or trigger in a workflow, or directly from the Connected Accounts page in Pipedream.
19
+
20
+ You'll first be prompted to enter your Zendesk subdomain. You can find this in the URL after logging into Zendesk.
21
+
22
+ The subdomain is the portion of the URL *before* `zendesk.com`.
23
+
24
+ For example, if the subdomain is `pipedream1903`, that's what you would enter in Pipedream.
25
+
26
+ ![Example of finding the Zendesk subdomain from the URL while logged into Zendesk](https://res.cloudinary.com/pipedreamin/image/upload/v1715183755/marketplace/apps/zendesk/CleanShot_2024-05-08_at_11.44.08_2x_ogzhhj.png)
27
+
28
+ Next, you'll be prompted to connect your Zendesk account. Zendesk will ask if you'd like to grant Pipedream permission to perform actions on your account; accept these permissions to continue.
29
+
30
+ And that's it! You can now automate Zendesk actions from within Pipedream workflows.
31
+
32
+ # Troubleshooting
33
+
34
+ ## Status Codes
35
+ Responses may have the status codes described in the following sections.
36
+
37
+ ### 200 range
38
+ The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.
39
+
40
+ ### 400 range
41
+ The request was not successful. The content type of the response may be text/plain for API-level error messages such as trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error:
42
+
43
+ ```json
44
+ {
45
+ "details": {
46
+ "value": [
47
+ {
48
+ "type": "blank",
49
+ "description": "can't be blank"
50
+ },
51
+ {
52
+ "type": "invalid",
53
+ "description": " is not properly formatted"
54
+ }
55
+ ]
56
+ },
57
+ "description": "RecordValidation errors",
58
+ "error": "RecordInvalid"
59
+ }
60
+ ```
61
+
62
+ If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent Zendesk Support instance.
63
+
64
+ ### **403**
65
+
66
+ A 403 response means the server has determined the user or the account doesn’t have the required permissions to use the API.
67
+
68
+ ### **409**
69
+
70
+ A 409 response indicates a conflict with the resource you're trying to create or update.
71
+
72
+ 409 errors typically occur when two or more requests try to create or change the same resource simultaneously. While Zendesk APIs can handle concurrent requests, requests shouldn't change the same resource at the same time. To avoid 409 errors, serialize requests when possible. If you receive a 409 error, you can retry your request after resolving the conflict.
73
+
74
+ The Zendesk Ticketing API provides specific parameters to prevent conflicts when updating tickets. For more information, see Protecting against ticket update collisions.
75
+
76
+ ### **422 Unprocessable Entity**
77
+
78
+ A 422 response means that the content type and the syntax of the request entity are correct, but the content itself is not processable by the server. This is usually due to the request entity not being relevant to the resource that it's trying to create or update. Example: Trying to close a ticket that's already closed.
79
+
80
+ ### **429**
81
+
82
+ A 429 error indicates that a usage limit has been exceeded. See the [Zendesk Rate limits](https://developer.zendesk.com/api-reference/introduction/rate-limits/).
83
+
84
+ ### **500 range**
85
+
86
+ If you ever experience responses with status codes in the 500 range, the Zendesk API may be experiencing internal issues or having a scheduled maintenance during which you might receive a 503 Service Unavailable status code.
87
+
88
+ A 503 response with a `Retry-After` header indicates a database timeout or deadlock. You can retry your request after the number of seconds specified in the `Retry-After` header.
89
+
90
+ If the 503 response doesn't have a Retry-After header, Zendesk Support may be experiencing internal issues or undergoing scheduled maintenance. In such cases, check `@zendeskops` and our status page for any known issues.
91
+
92
+ When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and if Zendesk doesn't have a publicly announced maintenance or service disruption, contact the [Zendesk Customer Support](https://support.zendesk.com/hc/en-us/articles/360026614173).
93
+
94
+ If submitting a ticket to Zendesk, provide the `X-Zendesk-Request-Id` header included in the HTTP response. This helps the Support team track down the request in the logs more quickly.
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Create Ticket",
6
6
  description: "Creates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket).",
7
7
  type: "action",
8
- version: "0.1.2",
8
+ version: "0.1.4",
9
9
  props: {
10
10
  app,
11
11
  ticketCommentBody: {
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Delete Ticket",
6
6
  description: "Deletes a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket).",
7
7
  type: "action",
8
- version: "0.1.2",
8
+ version: "0.1.4",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -0,0 +1,40 @@
1
+ import app from "../../zendesk.app.mjs";
2
+
3
+ export default {
4
+ key: "zendesk-get-ticket-info",
5
+ name: "Get Ticket Info",
6
+ description: "Retrieves information about a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket).",
7
+ type: "action",
8
+ version: "0.0.2",
9
+ props: {
10
+ app,
11
+ ticketId: {
12
+ propDefinition: [
13
+ app,
14
+ "ticketId",
15
+ ],
16
+ },
17
+ customSubdomain: {
18
+ propDefinition: [
19
+ app,
20
+ "customSubdomain",
21
+ ],
22
+ },
23
+ },
24
+ async run({ $: step }) {
25
+ const {
26
+ ticketId,
27
+ customSubdomain,
28
+ } = this;
29
+
30
+ const response = await this.app.getTicketInfo({
31
+ step,
32
+ ticketId,
33
+ customSubdomain,
34
+ });
35
+
36
+ step.export("$summary", `Successfully retrieved ticket with ID ${response.ticket.id}`);
37
+
38
+ return response;
39
+ },
40
+ };
@@ -0,0 +1,67 @@
1
+ import app from "../../zendesk.app.mjs";
2
+
3
+ export default {
4
+ key: "zendesk-list-tickets",
5
+ name: "List Tickets",
6
+ description: "Retrieves a list of tickets. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets).",
7
+ type: "action",
8
+ version: "0.0.2",
9
+ props: {
10
+ app,
11
+ sortBy: {
12
+ propDefinition: [
13
+ app,
14
+ "sortBy",
15
+ ],
16
+ },
17
+ sortOrder: {
18
+ propDefinition: [
19
+ app,
20
+ "sortOrder",
21
+ ],
22
+ },
23
+ limit: {
24
+ propDefinition: [
25
+ app,
26
+ "limit",
27
+ ],
28
+ },
29
+ customSubdomain: {
30
+ propDefinition: [
31
+ app,
32
+ "customSubdomain",
33
+ ],
34
+ },
35
+ },
36
+ async run({ $: step }) {
37
+ const {
38
+ sortBy,
39
+ sortOrder,
40
+ limit,
41
+ customSubdomain,
42
+ } = this;
43
+
44
+ const results = this.app.paginate({
45
+ fn: this.app.listTickets,
46
+ args: {
47
+ step,
48
+ customSubdomain,
49
+ params: {
50
+ sort_by: sortBy,
51
+ sort_order: sortOrder,
52
+ },
53
+ },
54
+ resourceKey: "tickets",
55
+ max: limit,
56
+ });
57
+
58
+ const tickets = [];
59
+ for await (const ticket of results) {
60
+ tickets.push(ticket);
61
+ }
62
+
63
+ step.export("$summary", `Successfully retrieved ${tickets.length} tickets`);
64
+
65
+ return tickets;
66
+ },
67
+ };
@@ -0,0 +1,74 @@
1
+ import app from "../../zendesk.app.mjs";
2
+
3
+ export default {
4
+ key: "zendesk-search-tickets",
5
+ name: "Search Tickets",
6
+ description: "Searches for tickets using Zendesk's search API. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#search-tickets).",
7
+ type: "action",
8
+ version: "0.0.2",
9
+ props: {
10
+ app,
11
+ query: {
12
+ type: "string",
13
+ label: "Search Query",
14
+ description: "The search query to find tickets. You can use Zendesk's search syntax. Example: `type:ticket status:open priority:high`. [See the documentation](https://developer.zendesk.com/documentation/ticketing/using-the-zendesk-api/searching-with-the-zendesk-api/)",
15
+ },
16
+ sortBy: {
17
+ propDefinition: [
18
+ app,
19
+ "sortBy",
20
+ ],
21
+ },
22
+ sortOrder: {
23
+ propDefinition: [
24
+ app,
25
+ "sortOrder",
26
+ ],
27
+ },
28
+ limit: {
29
+ propDefinition: [
30
+ app,
31
+ "limit",
32
+ ],
33
+ },
34
+ customSubdomain: {
35
+ propDefinition: [
36
+ app,
37
+ "customSubdomain",
38
+ ],
39
+ },
40
+ },
41
+ async run({ $: step }) {
42
+ const {
43
+ query,
44
+ sortBy,
45
+ sortOrder,
46
+ limit,
47
+ customSubdomain,
48
+ } = this;
49
+
50
+ const results = this.app.paginate({
51
+ fn: this.app.searchTickets,
52
+ args: {
53
+ step,
54
+ customSubdomain,
55
+ params: {
56
+ query,
57
+ sort_by: sortBy,
58
+ sort_order: sortOrder,
59
+ },
60
+ },
61
+ resourceKey: "results",
62
+ max: limit,
63
+ });
64
+
65
+ const tickets = [];
66
+ for await (const ticket of results) {
67
+ tickets.push(ticket);
68
+ }
69
+
70
+ step.export("$summary", `Successfully found ${tickets.length} tickets matching the search query`);
71
+
72
+ return tickets;
73
+ },
74
+ };
@@ -5,7 +5,7 @@ export default {
5
5
  name: "Update Ticket",
6
6
  description: "Updates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
7
7
  type: "action",
8
- version: "0.1.2",
8
+ version: "0.1.4",
9
9
  props: {
10
10
  app,
11
11
  ticketId: {
@@ -20,6 +20,12 @@ export default {
20
20
  "ticketCommentBody",
21
21
  ],
22
22
  },
23
+ ticketCommentBodyIsHTML: {
24
+ propDefinition: [
25
+ app,
26
+ "ticketCommentBodyIsHTML",
27
+ ],
28
+ },
23
29
  ticketPriority: {
24
30
  propDefinition: [
25
31
  app,
@@ -38,6 +44,12 @@ export default {
38
44
  "ticketStatus",
39
45
  ],
40
46
  },
47
+ ticketCommentPublic: {
48
+ propDefinition: [
49
+ app,
50
+ "ticketCommentPublic",
51
+ ],
52
+ },
41
53
  customSubdomain: {
42
54
  propDefinition: [
43
55
  app,
@@ -59,21 +71,31 @@ export default {
59
71
  const {
60
72
  ticketId,
61
73
  ticketCommentBody,
74
+ ticketCommentBodyIsHTML,
62
75
  ticketPriority,
63
76
  ticketSubject,
64
77
  ticketStatus,
78
+ ticketCommentPublic,
65
79
  customSubdomain,
66
80
  } = this;
67
81
 
82
+ const ticketComment = ticketCommentBodyIsHTML
83
+ ? {
84
+ html_body: ticketCommentBody,
85
+ }
86
+ : {
87
+ body: ticketCommentBody,
88
+ };
89
+
90
+ ticketComment.public = ticketCommentPublic;
91
+
68
92
  const response = await this.updateTicket({
69
93
  step,
70
94
  ticketId,
71
95
  customSubdomain,
72
96
  data: {
73
97
  ticket: {
74
- comment: {
75
- body: ticketCommentBody,
76
- },
98
+ comment: ticketComment,
77
99
  priority: ticketPriority,
78
100
  subject: ticketSubject,
79
101
  status: ticketStatus,
@@ -222,6 +222,19 @@ const TICKET_FIELD_OPTIONS = [
222
222
  },
223
223
  ];
224
224
 
225
+ const SORT_BY_OPTIONS = [
226
+ "assignee",
227
+ "assignee.name",
228
+ "created_at",
229
+ "group",
230
+ "id",
231
+ "requester",
232
+ "requester.name",
233
+ "status",
234
+ "subject",
235
+ "updated_at",
236
+ ];
237
+
225
238
  export default {
226
239
  SUBDOMAIN_PLACEHOLDER,
227
240
  BASE_URL,
@@ -242,4 +255,5 @@ export default {
242
255
  TICKET_PRIORITY_OPTIONS,
243
256
  TICKET_STATUS_OPTIONS,
244
257
  TICKET_FIELD_OPTIONS,
258
+ SORT_BY_OPTIONS,
245
259
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/zendesk",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "description": "Pipedream Zendesk Components",
5
5
  "main": "zendesk.app.mjs",
6
6
  "keywords": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@pipedream/platform": "^0.9.0",
17
+ "@pipedream/platform": "^3.0.3",
18
18
  "crypto": "^1.0.1"
19
19
  }
20
20
  }
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-new-ticket",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket is created",
9
- version: "0.2.2",
9
+ version: "0.2.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "zendesk-ticket-added-to-view",
6
6
  name: "New Ticket Added to View (Instant)",
7
7
  description: "Emit new event when a ticket is added to the specified view",
8
- version: "0.0.2",
8
+ version: "0.0.4",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-closed",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to closed status",
9
- version: "0.2.2",
9
+ version: "0.2.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-pended",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to pending status",
9
- version: "0.2.2",
9
+ version: "0.2.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-solved",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has changed to solved status",
9
- version: "0.2.2",
9
+ version: "0.2.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "zendesk-ticket-updated",
7
7
  type: "source",
8
8
  description: "Emit new event when a ticket has been updated",
9
- version: "0.2.2",
9
+ version: "0.2.4",
10
10
  dedupe: "unique",
11
11
  methods: {
12
12
  ...common.methods,
package/zendesk.app.mjs CHANGED
@@ -9,6 +9,7 @@ export default {
9
9
  type: "string",
10
10
  label: "Trigger Category ID",
11
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
+ optional: true,
12
13
  async options({ prevContext }) {
13
14
  const { afterCursor } = prevContext;
14
15
 
@@ -124,6 +125,13 @@ export default {
124
125
  label: "Comment body",
125
126
  description: "The body of the comment.",
126
127
  },
128
+ ticketCommentBodyIsHTML: {
129
+ type: "boolean",
130
+ label: "Comment body is HTML",
131
+ description: "Whether the comment body is HTML. Default is `false`, which expects Markdown",
132
+ default: false,
133
+ optional: true,
134
+ },
127
135
  ticketPriority: {
128
136
  type: "string",
129
137
  label: "Ticket Priority",
@@ -144,6 +152,37 @@ export default {
144
152
  optional: true,
145
153
  options: Object.values(constants.TICKET_STATUS_OPTIONS),
146
154
  },
155
+ ticketCommentPublic: {
156
+ type: "boolean",
157
+ label: "Comment Public",
158
+ description: "Whether the comment is public. Default is `true`",
159
+ default: true,
160
+ optional: true,
161
+ },
162
+ sortBy: {
163
+ type: "string",
164
+ label: "Sort By",
165
+ description: "Field to sort tickets by",
166
+ optional: true,
167
+ options: constants.SORT_BY_OPTIONS,
168
+ },
169
+ sortOrder: {
170
+ type: "string",
171
+ label: "Sort Order",
172
+ description: "Sort order (ascending or descending)",
173
+ optional: true,
174
+ options: [
175
+ "asc",
176
+ "desc",
177
+ ],
178
+ },
179
+ limit: {
180
+ type: "integer",
181
+ label: "Limit",
182
+ description: "Maximum number of tickets to return",
183
+ optional: true,
184
+ default: 100,
185
+ },
147
186
  customSubdomain: {
148
187
  type: "string",
149
188
  label: "Custom Subdomain",
@@ -181,6 +220,20 @@ export default {
181
220
  };
182
221
  return axios(step, config);
183
222
  },
223
+ getTicketInfo({
224
+ ticketId, ...args
225
+ } = {}) {
226
+ return this.makeRequest({
227
+ path: `/tickets/${ticketId}`,
228
+ ...args,
229
+ });
230
+ },
231
+ searchTickets(args = {}) {
232
+ return this.makeRequest({
233
+ path: "/search",
234
+ ...args,
235
+ });
236
+ },
184
237
  create(args = {}) {
185
238
  return this.makeRequest({
186
239
  method: "post",
@@ -231,5 +284,36 @@ export default {
231
284
  ...args,
232
285
  });
233
286
  },
287
+ async *paginate({
288
+ fn, args, resourceKey, max,
289
+ }) {
290
+ args = {
291
+ ...args,
292
+ params: {
293
+ ...args?.params,
294
+ per_page: constants.DEFAULT_LIMIT,
295
+ page: 1,
296
+ },
297
+ };
298
+ let hasMore = true;
299
+ let count = 0;
300
+ while (hasMore) {
301
+ const response = await fn(args);
302
+ const items = resourceKey
303
+ ? response[resourceKey]
304
+ : response;
305
+ if (!items?.length) {
306
+ return;
307
+ }
308
+ for (const item of items) {
309
+ yield item;
310
+ if (max && ++count >= max) {
311
+ return;
312
+ }
313
+ }
314
+ hasMore = !!response.next_page;
315
+ args.params.page += 1;
316
+ }
317
+ },
234
318
  },
235
319
  };