Skip to content

Add ticket tag management to Zendesk integration #17609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions components/zendesk/actions/add-ticket-tags/add-ticket-tags.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import app from "../../zendesk.app.mjs";

export default {
key: "zendesk-add-ticket-tags",
name: "Add Ticket Tags",
description: "Add tags to a ticket (appends to existing tags). [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#add-tags).",
type: "action",
version: "0.0.1",
props: {
app,
ticketId: {
propDefinition: [
app,
"ticketId",
],
},
ticketTags: {
propDefinition: [
app,
"ticketTags",
],
description: "Array of tags to add to the ticket. These will be appended to any existing tags.",
},
customSubdomain: {
propDefinition: [
app,
"customSubdomain",
],
},
},
async run({ $: step }) {
const {
ticketId,
ticketTags,
customSubdomain,
} = this;

const response = await this.app.addTicketTags({
step,
ticketId,
tags: ticketTags,
customSubdomain,
});

step.export("$summary", `Successfully added ${ticketTags.length} tag(s) to ticket ${ticketId}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/zendesk/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Create Ticket",
description: "Creates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#create-ticket).",
type: "action",
version: "0.1.4",
version: "0.1.5",
props: {
app,
ticketCommentBody: {
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/actions/delete-ticket/delete-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Delete Ticket",
description: "Deletes a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#delete-ticket).",
type: "action",
version: "0.1.4",
version: "0.1.5",
props: {
app,
ticketId: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Get Ticket Info",
description: "Retrieves information about a specific ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#show-ticket).",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
ticketId: {
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/actions/list-tickets/list-tickets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "List Tickets",
description: "Retrieves a list of tickets. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#list-tickets).",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
sortBy: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import app from "../../zendesk.app.mjs";

export default {
key: "zendesk-remove-ticket-tags",
name: "Remove Ticket Tags",
description: "Remove specific tags from a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#remove-tags).",
type: "action",
version: "0.0.1",
props: {
app,
ticketId: {
propDefinition: [
app,
"ticketId",
],
},
ticketTags: {
propDefinition: [
app,
"ticketTags",
],
description: "Array of tags to remove from the ticket.",
},
customSubdomain: {
propDefinition: [
app,
"customSubdomain",
],
},
},
async run({ $: step }) {
const {
ticketId,
ticketTags,
customSubdomain,
} = this;

const response = await this.app.removeTicketTags({
step,
ticketId,
tags: ticketTags,
customSubdomain,
});

step.export("$summary", `Successfully removed ${ticketTags.length} tag(s) from ticket ${ticketId}`);
return response;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Search Tickets",
description: "Searches for tickets using Zendesk's search API. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#search-tickets).",
type: "action",
version: "0.0.2",
version: "0.0.3",
props: {
app,
query: {
Expand Down
47 changes: 47 additions & 0 deletions components/zendesk/actions/set-ticket-tags/set-ticket-tags.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import app from "../../zendesk.app.mjs";

export default {
key: "zendesk-set-ticket-tags",
name: "Set Ticket Tags",
description: "Set tags on a ticket (replaces all existing tags). [See the documentation](https://developer.zendesk.com/api-reference/ticketing/ticket-management/tags/#set-tags).",
type: "action",
version: "0.0.1",
props: {
app,
ticketId: {
propDefinition: [
app,
"ticketId",
],
},
ticketTags: {
propDefinition: [
app,
"ticketTags",
],
},
customSubdomain: {
propDefinition: [
app,
"customSubdomain",
],
},
},
async run({ $: step }) {
const {
ticketId,
ticketTags,
customSubdomain,
} = this;

const response = await this.app.setTicketTags({
step,
ticketId,
tags: ticketTags,
customSubdomain,
});

step.export("$summary", `Successfully set ${ticketTags.length} tag(s) on ticket ${ticketId}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/zendesk/actions/update-ticket/update-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Update Ticket",
description: "Updates a ticket. [See the documentation](https://developer.zendesk.com/api-reference/ticketing/tickets/tickets/#update-ticket).",
type: "action",
version: "0.1.4",
version: "0.1.5",
props: {
app,
ticketId: {
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/zendesk",
"version": "0.7.1",
"version": "0.8.0",
"description": "Pipedream Zendesk Components",
"main": "zendesk.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/sources/new-ticket/new-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zendesk-new-ticket",
type: "source",
description: "Emit new event when a ticket is created",
version: "0.2.4",
version: "0.2.5",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zendesk-ticket-added-to-view",
name: "New Ticket Added to View (Instant)",
description: "Emit new event when a ticket is added to the specified view",
version: "0.0.4",
version: "0.0.5",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/sources/ticket-closed/ticket-closed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

export default {
...common,
name: "Ticket Closed (Instant)",

Check warning on line 5 in components/zendesk/sources/ticket-closed/ticket-closed.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
key: "zendesk-ticket-closed",
type: "source",
description: "Emit new event when a ticket has changed to closed status",
version: "0.2.4",
version: "0.2.5",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/sources/ticket-pended/ticket-pended.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

export default {
...common,
name: "Ticket Pending (Instant)",

Check warning on line 5 in components/zendesk/sources/ticket-pended/ticket-pended.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
key: "zendesk-ticket-pended",
type: "source",
description: "Emit new event when a ticket has changed to pending status",
version: "0.2.4",
version: "0.2.5",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
2 changes: 1 addition & 1 deletion components/zendesk/sources/ticket-solved/ticket-solved.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

export default {
...common,
name: "Ticket Solved (Instant)",

Check warning on line 5 in components/zendesk/sources/ticket-solved/ticket-solved.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
key: "zendesk-ticket-solved",
type: "source",
description: "Emit new event when a ticket has changed to solved status",
version: "0.2.4",
version: "0.2.5",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

export default {
...common,
name: "Ticket Updated (Instant)",

Check warning on line 5 in components/zendesk/sources/ticket-updated/ticket-updated.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
key: "zendesk-ticket-updated",
type: "source",
description: "Emit new event when a ticket has been updated",
version: "0.2.4",
version: "0.2.5",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
69 changes: 69 additions & 0 deletions components/zendesk/zendesk.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ export default {
description: "For Enterprise Zendesk accounts: optionally specify the subdomain to use. This will override the subdomain that was provided when connecting your Zendesk account to Pipedream. For example, if you Zendesk URL is https://examplehelp.zendesk.com, your subdomain is `examplehelp`",
optional: true,
},
ticketTags: {
type: "string[]",
label: "Tags",
description: "Array of tags to apply to the ticket. These will replace any existing tags on the ticket.",
optional: true,
},
},
methods: {
getUrl(path, customSubdomain) {
Expand Down Expand Up @@ -315,5 +321,68 @@ export default {
args.params.page += 1;
}
},
/**
* Set tags on a ticket (replaces all existing tags)
* @param {object} args - Arguments object
* @param {string} args.ticketId - The ticket ID
* @param {string[]} args.tags - Array of tags to set
* @param {string} args.customSubdomain - Optional custom subdomain
* @returns {Promise<object>} API response
*/
setTicketTags({
ticketId, tags, customSubdomain, ...args
}) {
return this.makeRequest({
method: "PUT",
path: `/tickets/${ticketId}/tags.json`,
customSubdomain,
data: {
tags,
},
...args,
});
},
/**
* Add tags to a ticket (appends to existing tags)
* @param {object} args - Arguments object
* @param {string} args.ticketId - The ticket ID
* @param {string[]} args.tags - Array of tags to add
* @param {string} args.customSubdomain - Optional custom subdomain
* @returns {Promise<object>} API response
*/
addTicketTags({
ticketId, tags, customSubdomain, ...args
}) {
return this.makeRequest({
method: "POST",
path: `/tickets/${ticketId}/tags.json`,
customSubdomain,
data: {
tags,
},
...args,
});
},
/**
* Remove specific tags from a ticket
* @param {object} args - Arguments object
* @param {string} args.ticketId - The ticket ID
* @param {string[]} args.tags - Array of tags to remove
* @param {string} args.customSubdomain - Optional custom subdomain
* @returns {Promise<object>} API response
*/
removeTicketTags({
ticketId, tags, customSubdomain, ...args
}) {
return this.makeRequest({
method: "DELETE",
path: `/tickets/${ticketId}/tags.json`,
customSubdomain,
data: {
tags,
},
...args,
});
},
},
};
Loading