Add support for suspended tickets to Zendesk node (#2297)

* Added Suspended Tickets (Delete, List, Get, Recover)

* Added Search option to Active tickets

* Added internal note, public reply and assignee email options to active ticket updates

*  Small improvements to #2296

* 🐛 Fix issue with pagination

*  Improvements

Co-authored-by: Jonathan <jonathan.bennetts@gmail.com>
This commit is contained in:
Ricardo Espinoza
2021-10-13 19:45:53 -04:00
committed by GitHub
parent d49aa18717
commit 7ddd6ad9c2
4 changed files with 241 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import {
INodeProperties,
} from 'n8n-workflow';
} from 'n8n-workflow';
export const ticketOperations = [
{
@@ -35,6 +35,11 @@ export const ticketOperations = [
value: 'getAll',
description: 'Get all tickets',
},
{
name: 'Recover',
value: 'recover',
description: 'Recover a suspended ticket',
},
{
name: 'Update',
value: 'update',
@@ -48,9 +53,9 @@ export const ticketOperations = [
export const ticketFields = [
/* -------------------------------------------------------------------------- */
/* ticket:create */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* ticket:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Description',
name: 'description',
@@ -265,9 +270,9 @@ export const ticketFields = [
description: `Object of values to set as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>.`,
},
/* -------------------------------------------------------------------------- */
/* ticket:update */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* ticket:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Ticket ID',
name: 'id',
@@ -323,6 +328,13 @@ export const ticketFields = [
},
},
options: [
{
displayName: 'Assignee Email',
name: 'assigneeEmail',
type: 'string',
default: '',
description: 'The e-mail address of the assignee',
},
{
displayName: 'Custom Fields',
name: 'customFieldsUi',
@@ -375,6 +387,20 @@ export const ticketFields = [
default: '',
description: 'The group this ticket is assigned to',
},
{
displayName: 'Internal Note',
name: 'internalNote',
type: 'string',
default: '',
description: 'Internal Ticket Note (Accepts HTML)',
},
{
displayName: 'Public Reply',
name: 'publicReply',
type: 'string',
default: '',
description: 'Public ticket reply',
},
{
displayName: 'Recipient',
name: 'recipient',
@@ -478,10 +504,38 @@ export const ticketFields = [
},
description: `Object of values to update as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>.`,
},
/* -------------------------------------------------------------------------- */
/* ticket:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Ticket Type',
name: 'ticketType',
type: 'options',
options: [
{
name: 'Regular',
value: 'regular',
},
{
name: 'Suspended',
value: 'suspended',
},
],
default: 'regular',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'get',
'delete',
'getAll',
],
},
},
},
/* -------------------------------------------------------------------------- */
/* ticket:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Ticket ID',
name: 'id',
@@ -496,13 +550,37 @@ export const ticketFields = [
operation: [
'get',
],
ticketType: [
'regular',
],
},
},
description: 'Ticket ID',
},
/* -------------------------------------------------------------------------- */
/* ticket:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Suspended Ticket ID',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'get',
],
ticketType: [
'suspended',
],
},
},
description: 'Ticket ID',
},
/* -------------------------------------------------------------------------- */
/* ticket:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
@@ -561,6 +639,37 @@ export const ticketFields = [
},
},
options: [
{
displayName: 'Group',
name: 'group',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getGroups',
},
displayOptions: {
show: {
'/ticketType': [
'regular',
],
},
},
default: '',
description: 'The group to search',
},
{
displayName: 'Query',
name: 'query',
type: 'string',
displayOptions: {
show: {
'/ticketType': [
'regular',
],
},
},
default: '',
description: '<a href="https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#syntax-examples">Query syntax</a> to search tickets',
},
{
displayName: 'Sort By',
name: 'sortBy',
@@ -596,21 +705,28 @@ export const ticketFields = [
type: 'options',
options: [
{
name: 'Asc',
name: 'Ascending',
value: 'asc',
},
{
name: 'Desc',
name: 'Descending',
value: 'desc',
},
],
default: 'desc',
default: 'asc',
description: 'Sort order',
},
{
displayName: 'Status',
name: 'status',
type: 'options',
displayOptions: {
show: {
'/ticketType': [
'regular',
],
},
},
options: [
{
name: 'Open',
@@ -639,9 +755,9 @@ export const ticketFields = [
],
},
/* -------------------------------------------------------------------------- */
/* ticket:delete */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* ticket:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Ticket ID',
name: 'id',
@@ -656,8 +772,52 @@ export const ticketFields = [
operation: [
'delete',
],
ticketType: [
'regular',
],
},
},
description: 'Ticket ID',
},
{
displayName: 'Suspended Ticket ID',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'delete',
],
ticketType: [
'suspended',
],
},
},
description: 'Ticket ID',
},
/* -------------------------------------------------------------------------- */
/* ticket:recover */
/* -------------------------------------------------------------------------- */
{
displayName: 'Suspended Ticket ID',
name: 'id',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'recover',
],
},
},
},
] as INodeProperties[];