2020-04-06 16:11:50 -07:00
import {
INodeProperties ,
2021-10-13 16:45:53 -07:00
} from 'n8n-workflow' ;
2020-01-07 11:56:42 -08:00
2021-12-03 00:44:16 -08:00
export const ticketOperations : INodeProperties [ ] = [
2020-01-07 11:56:42 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-01-07 11:56:42 -08:00
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Create a ticket' ,
2020-01-07 11:56:42 -08:00
} ,
{
2020-04-09 13:13:14 -07:00
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a ticket' ,
2020-01-07 11:56:42 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
2020-01-07 19:15:37 -08:00
description : 'Get a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Get a ticket' ,
2020-01-07 11:56:42 -08:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
2020-01-07 19:15:37 -08:00
description : 'Get all tickets' ,
2022-07-10 13:50:51 -07:00
action : 'Get all tickets' ,
2020-01-07 11:56:42 -08:00
} ,
2021-10-13 16:45:53 -07:00
{
name : 'Recover' ,
value : 'recover' ,
description : 'Recover a suspended ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Recover a ticket' ,
2021-10-13 16:45:53 -07:00
} ,
2020-01-07 11:56:42 -08:00
{
2020-04-09 13:13:14 -07:00
name : 'Update' ,
value : 'update' ,
description : 'Update a ticket' ,
2022-07-10 13:50:51 -07:00
action : 'Update a ticket' ,
2020-01-07 11:56:42 -08:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-01-07 11:56:42 -08:00
2021-12-03 00:44:16 -08:00
export const ticketFields : INodeProperties [ ] = [
2020-01-07 11:56:42 -08:00
2021-10-13 16:45:53 -07:00
/* -------------------------------------------------------------------------- */
/* ticket:create */
/* -------------------------------------------------------------------------- */
2020-01-07 11:56:42 -08:00
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
required : true ,
description : 'The first comment on the ticket' ,
} ,
2020-04-06 16:11:50 -07:00
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
resource : [
2020-04-09 13:13:14 -07:00
'ticket' ,
2020-04-06 16:11:50 -07:00
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
2020-04-09 13:13:14 -07:00
jsonParameters : [
false ,
] ,
2020-01-07 11:56:42 -08:00
} ,
} ,
options : [
2020-04-11 05:56:25 -07:00
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
displayName : 'Custom Field' ,
name : 'customFieldsValues' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Name or ID' ,
2020-04-11 05:56:25 -07:00
name : 'id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-04-11 05:56:25 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Custom field Value' ,
2020-04-11 05:56:25 -07:00
} ,
] ,
} ,
] ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'External ID' ,
name : 'externalId' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'An ID you can use to link Zendesk Support tickets to local records' ,
2020-01-07 11:56:42 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Group Name or ID' ,
2020-04-09 13:13:14 -07:00
name : 'group' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getGroups' ,
} ,
2020-01-07 11:56:42 -08:00
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-01-07 11:56:42 -08:00
} ,
{
displayName : 'Recipient' ,
name : 'recipient' ,
type : 'string' ,
default : '' ,
description : 'The original recipient e-mail address of the ticket' ,
} ,
{
2020-04-09 13:13:14 -07:00
displayName : 'Status' ,
name : 'status' ,
2020-01-07 11:56:42 -08:00
type : 'options' ,
2020-04-09 13:13:14 -07:00
options : [
{
2022-03-27 03:26:19 -07:00
name : 'Closed' ,
value : 'closed' ,
2020-04-09 13:13:14 -07:00
} ,
{
name : 'New' ,
value : 'new' ,
} ,
2022-03-27 03:26:19 -07:00
{
2022-06-03 10:23:49 -07:00
name : 'On-Hold' ,
2022-03-27 03:26:19 -07:00
value : 'hold' ,
} ,
{
name : 'Open' ,
value : 'open' ,
} ,
2020-04-09 13:13:14 -07:00
{
name : 'Pending' ,
value : 'pending' ,
} ,
{
name : 'Solved' ,
value : 'solved' ,
} ,
] ,
2020-01-07 11:56:42 -08:00
default : '' ,
2020-04-09 13:13:14 -07:00
description : 'The state of the ticket' ,
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
description : 'The value of the subject field for this ticket' ,
2020-01-07 11:56:42 -08:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-01-07 11:56:42 -08:00
name : 'tags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-01-07 11:56:42 -08:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Question' ,
value : 'question' ,
} ,
{
name : 'Incident' ,
value : 'incident' ,
} ,
{
name : 'Problem' ,
value : 'problem' ,
} ,
{
name : 'Task' ,
value : 'task' ,
} ,
] ,
default : '' ,
description : 'The type of this ticket' ,
} ,
2020-04-09 13:13:14 -07:00
] ,
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Additional Fields' ,
2020-04-09 13:13:14 -07:00
name : 'additionalFieldsJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'create' ,
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Object of values to set as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>' ,
2020-04-09 13:13:14 -07:00
} ,
2020-04-11 05:56:25 -07:00
2021-10-13 16:45:53 -07:00
/* -------------------------------------------------------------------------- */
/* ticket:update */
/* -------------------------------------------------------------------------- */
2020-01-07 11:56:42 -08:00
{
2020-04-09 13:13:14 -07:00
displayName : 'Ticket ID' ,
2020-01-07 11:56:42 -08:00
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
} ,
2020-04-06 16:11:50 -07:00
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
resource : [
2020-10-22 06:46:03 -07:00
'ticket' ,
2020-04-06 16:11:50 -07:00
] ,
operation : [
'update' ,
] ,
} ,
} ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'update' ,
] ,
2020-04-09 13:13:14 -07:00
jsonParameters : [
false ,
] ,
2020-01-07 11:56:42 -08:00
} ,
} ,
options : [
2021-10-13 16:45:53 -07:00
{
displayName : 'Assignee Email' ,
name : 'assigneeEmail' ,
type : 'string' ,
default : '' ,
description : 'The e-mail address of the assignee' ,
} ,
2020-04-11 05:56:25 -07:00
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
displayName : 'Custom Field' ,
name : 'customFieldsValues' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Name or ID' ,
2020-04-11 05:56:25 -07:00
name : 'id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-04-11 05:56:25 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Custom field Value' ,
2020-04-11 05:56:25 -07:00
} ,
] ,
} ,
] ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'External ID' ,
name : 'externalId' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'An ID you can use to link Zendesk Support tickets to local records' ,
2020-01-07 11:56:42 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Group Name or ID' ,
2020-04-09 13:13:14 -07:00
name : 'group' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getGroups' ,
} ,
2020-01-07 11:56:42 -08:00
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-01-07 11:56:42 -08:00
} ,
2021-10-13 16:45:53 -07:00
{
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' ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'Recipient' ,
name : 'recipient' ,
type : 'string' ,
default : '' ,
description : 'The original recipient e-mail address of the ticket' ,
} ,
{
2020-04-09 13:13:14 -07:00
displayName : 'Status' ,
name : 'status' ,
2020-01-07 11:56:42 -08:00
type : 'options' ,
2020-04-09 13:13:14 -07:00
options : [
{
2022-03-27 03:26:19 -07:00
name : 'Closed' ,
value : 'closed' ,
2020-04-09 13:13:14 -07:00
} ,
{
name : 'New' ,
value : 'new' ,
} ,
2022-03-27 03:26:19 -07:00
{
2022-06-03 10:23:49 -07:00
name : 'On-Hold' ,
2022-03-27 03:26:19 -07:00
value : 'hold' ,
} ,
{
name : 'Open' ,
value : 'open' ,
} ,
2020-04-09 13:13:14 -07:00
{
name : 'Pending' ,
value : 'pending' ,
} ,
{
name : 'Solved' ,
value : 'solved' ,
} ,
] ,
2020-01-07 11:56:42 -08:00
default : '' ,
2020-04-09 13:13:14 -07:00
description : 'The state of the ticket' ,
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
description : 'The value of the subject field for this ticket' ,
2020-01-07 11:56:42 -08:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-01-07 11:56:42 -08:00
name : 'tags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-01-07 11:56:42 -08:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Question' ,
value : 'question' ,
} ,
{
name : 'Incident' ,
value : 'incident' ,
} ,
{
name : 'Problem' ,
value : 'problem' ,
} ,
{
name : 'Task' ,
value : 'task' ,
} ,
] ,
default : '' ,
description : 'The type of this ticket' ,
} ,
2020-04-09 13:13:14 -07:00
] ,
} ,
{
2022-05-20 14:47:24 -07:00
displayName : 'Update Fields' ,
2020-04-09 13:13:14 -07:00
name : 'updateFieldsJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
default : '' ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'update' ,
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Object of values to update as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>' ,
2020-04-09 13:13:14 -07:00
} ,
2021-10-13 16:45:53 -07:00
{
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 */
/* -------------------------------------------------------------------------- */
2020-01-07 11:56:42 -08:00
{
2020-04-09 13:13:14 -07:00
displayName : 'Ticket ID' ,
2020-01-07 11:56:42 -08:00
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'get' ,
] ,
2021-10-13 16:45:53 -07:00
ticketType : [
'regular' ,
] ,
} ,
} ,
} ,
{
displayName : 'Suspended Ticket ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'get' ,
] ,
ticketType : [
'suspended' ,
] ,
2020-01-07 11:56:42 -08:00
} ,
} ,
description : 'Ticket ID' ,
} ,
2021-10-13 16:45:53 -07:00
/* -------------------------------------------------------------------------- */
/* ticket:getAll */
/* -------------------------------------------------------------------------- */
2020-01-07 11:56:42 -08:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-01-07 11:56:42 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-01-07 11:56:42 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Option' ,
default : { } ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
options : [
2021-10-13 16:45:53 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Group Name or ID' ,
2021-10-13 16:45:53 -07:00
name : 'group' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getGroups' ,
} ,
displayOptions : {
show : {
'/ticketType' : [
'regular' ,
] ,
} ,
} ,
default : '' ,
2022-07-14 13:05:11 -07:00
description : 'The group to search. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-10-13 16:45:53 -07:00
} ,
{
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' ,
} ,
2020-01-07 11:56:42 -08:00
{
displayName : 'Sort By' ,
name : 'sortBy' ,
type : 'options' ,
options : [
{
name : 'Created At' ,
value : 'created_at' ,
} ,
{
name : 'Priority' ,
value : 'priority' ,
} ,
{
name : 'Status' ,
value : 'status' ,
} ,
{
name : 'Ticket Type' ,
value : 'ticket_type' ,
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Updated At' ,
value : 'updated_at' ,
} ,
2020-01-07 11:56:42 -08:00
] ,
default : 'updated_at' ,
description : 'Defaults to sorting by relevance' ,
} ,
{
displayName : 'Sort Order' ,
name : 'sortOrder' ,
type : 'options' ,
options : [
{
2021-10-13 16:45:53 -07:00
name : 'Ascending' ,
2020-01-07 11:56:42 -08:00
value : 'asc' ,
} ,
{
2021-10-13 16:45:53 -07:00
name : 'Descending' ,
2020-01-07 11:56:42 -08:00
value : 'desc' ,
} ,
] ,
2021-10-13 16:45:53 -07:00
default : 'asc' ,
2020-04-09 13:13:14 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
2021-10-13 16:45:53 -07:00
displayOptions : {
show : {
'/ticketType' : [
'regular' ,
] ,
} ,
} ,
2020-04-09 13:13:14 -07:00
options : [
{
2022-03-27 03:26:19 -07:00
name : 'Closed' ,
value : 'closed' ,
2020-04-09 13:13:14 -07:00
} ,
{
name : 'New' ,
value : 'new' ,
} ,
2022-03-27 03:26:19 -07:00
{
2022-06-03 10:23:49 -07:00
name : 'On-Hold' ,
2022-03-27 03:26:19 -07:00
value : 'hold' ,
} ,
{
name : 'Open' ,
value : 'open' ,
} ,
2020-04-09 13:13:14 -07:00
{
name : 'Pending' ,
value : 'pending' ,
} ,
{
name : 'Solved' ,
value : 'solved' ,
} ,
] ,
default : '' ,
description : 'The state of the ticket' ,
} ,
2020-01-07 11:56:42 -08:00
] ,
} ,
2021-10-13 16:45:53 -07:00
/* -------------------------------------------------------------------------- */
/* ticket:delete */
/* -------------------------------------------------------------------------- */
2020-01-07 11:56:42 -08:00
{
2020-04-09 13:13:14 -07:00
displayName : 'Ticket ID' ,
2020-01-07 11:56:42 -08:00
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'delete' ,
] ,
2021-10-13 16:45:53 -07:00
ticketType : [
'regular' ,
] ,
} ,
} ,
} ,
{
displayName : 'Suspended Ticket ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'delete' ,
] ,
ticketType : [
'suspended' ,
] ,
2020-01-07 11:56:42 -08:00
} ,
} ,
description : 'Ticket ID' ,
} ,
2021-10-13 16:45:53 -07:00
/* -------------------------------------------------------------------------- */
/* ticket:recover */
/* -------------------------------------------------------------------------- */
{
displayName : 'Suspended Ticket ID' ,
name : 'id' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'ticket' ,
] ,
operation : [
'recover' ,
] ,
} ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;