2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-03-16 19:02:48 -07:00
2021-12-03 00:44:16 -08:00
export const conversationOperations : INodeProperties [ ] = [
2020-03-16 19:02:48 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-03-16 19:02:48 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new conversation' ,
2022-07-10 13:50:51 -07:00
action : 'Create a conversation' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a conversation' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a conversation' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a conversation' ,
2022-07-10 13:50:51 -07:00
action : 'Get a conversation' ,
2020-03-16 19:02:48 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-03-16 19:02:48 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many conversations' ,
2022-09-08 08:10:13 -07:00
action : 'Get many conversations' ,
2020-03-16 19:02:48 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-03-16 19:02:48 -07:00
2021-12-03 00:44:16 -08:00
export const conversationFields : INodeProperties [ ] = [
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* conversation:create */
/* -------------------------------------------------------------------------- */
2020-03-16 19:02:48 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Mailbox Name or ID' ,
2020-03-16 19:02:48 -07:00
name : 'mailboxId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getMailboxes' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'ID of a mailbox where the conversation is being created. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
required : true ,
options : [
{
name : 'Active' ,
value : 'active' ,
} ,
{
name : 'Closed' ,
value : 'closed' ,
} ,
{
name : 'Pending' ,
value : 'pending' ,
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
default : '' ,
description : 'Conversation status' ,
} ,
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Conversation’ s subject' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
required : true ,
type : 'options' ,
options : [
{
name : 'Chat' ,
value : 'chat' ,
} ,
{
name : 'Email' ,
value : 'email' ,
} ,
{
name : 'Phone' ,
value : 'phone' ,
} ,
] ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
default : '' ,
description : 'Conversation type' ,
} ,
{
displayName : 'Resolve Data' ,
name : 'resolveData' ,
type : 'boolean' ,
default : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
2022-08-17 08:50:24 -07:00
description :
'By default the response only contain the ID to resource. If this option gets activated, it will resolve the data automatically.' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
options : [
{
displayName : 'Assign To' ,
name : 'assignTo' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'The Help Scout user assigned to the conversation' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Auto Reply' ,
name : 'autoReply' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether set to true, an auto reply will be sent as long as there is at least one customer thread in the conversation' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Closed At' ,
name : 'closedAt' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'When the conversation was closed, only applicable for imported conversations' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Created At' ,
name : 'createdAt' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'When this conversation was created - ISO 8601 date time' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Customer Email' ,
name : 'customerEmail' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Customer ID' ,
name : 'customerId' ,
type : 'number' ,
default : 0 ,
} ,
{
displayName : 'Imported' ,
name : 'imported' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether set to true, no outgoing emails or notifications will be generated' ,
2020-03-16 19:02:48 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-03-16 19:02:48 -07:00
name : 'tags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'List of tags to be added to the conversation. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'User ID' ,
name : 'user' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the user who is adding the conversation and threads' ,
2020-03-16 19:02:48 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Threads' ,
name : 'threadsUi' ,
placeholder : 'Add Thread' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'conversation' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Thread' ,
name : 'threadsValues' ,
values : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Chat' ,
2020-10-22 06:46:03 -07:00
value : 'chat' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Customer' ,
2020-10-22 06:46:03 -07:00
value : 'customer' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Note' ,
2020-10-22 06:46:03 -07:00
value : 'note' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Phone' ,
2020-10-22 06:46:03 -07:00
value : 'phone' ,
2020-03-16 19:02:48 -07:00
} ,
{
name : 'Reply' ,
2020-10-22 06:46:03 -07:00
value : 'reply' ,
2020-03-16 19:02:48 -07:00
} ,
] ,
default : '' ,
} ,
{
displayName : 'Text' ,
name : 'text' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The message text' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Bcc' ,
name : 'bcc' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'customer' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add Email' ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Email addresses' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Cc' ,
name : 'cc' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'customer' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
multipleValueButtonText : 'Add Email' ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'Email addresses' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Draft' ,
name : 'draft' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
type : [ 'reply' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether true, a draft reply is created' ,
2020-03-16 19:02:48 -07:00
} ,
] ,
} ,
] ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* conversation:get */
/* -------------------------------------------------------------------------- */
2020-03-16 19:02:48 -07:00
{
displayName : 'Conversation ID' ,
name : 'conversationId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'conversation' ] ,
operation : [ 'get' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* conversation:delete */
/* -------------------------------------------------------------------------- */
2020-03-16 19:02:48 -07:00
{
displayName : 'Conversation ID' ,
name : 'conversationId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'conversation' ] ,
operation : [ 'delete' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
} ,
2022-08-17 08:50:24 -07:00
/* -------------------------------------------------------------------------- */
/* conversation:getAll */
/* -------------------------------------------------------------------------- */
2020-03-29 19:08:00 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'conversation' ] ,
2020-03-29 19:08:00 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-03-29 19:08:00 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'conversation' ] ,
returnAll : [ false ] ,
2020-03-29 19:08:00 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-03-29 19:08:00 -07:00
} ,
2020-03-16 19:02:48 -07:00
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
2024-07-29 05:27:23 -07:00
placeholder : 'Add option' ,
2020-03-16 19:02:48 -07:00
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'conversation' ] ,
operation : [ 'getAll' ] ,
2020-03-16 19:02:48 -07:00
} ,
} ,
options : [
2020-03-29 10:10:54 -07:00
{
displayName : 'Assign To' ,
name : 'assignTo' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'Filters conversations by assignee ID' ,
2020-03-29 10:10:54 -07:00
} ,
2020-03-16 19:02:48 -07:00
{
displayName : 'Embed' ,
name : 'embed' ,
type : 'options' ,
options : [
{
name : 'Threads' ,
value : 'threads' ,
} ,
] ,
default : '' ,
description : 'Allows embedding/loading of sub-entities' ,
} ,
{
displayName : 'Folder ID' ,
name : 'folder' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filters conversations from a specific folder ID' ,
2020-03-16 19:02:48 -07:00
} ,
{
2020-03-29 10:10:54 -07:00
displayName : 'Mailbox ID' ,
name : 'mailbox' ,
type : 'string' ,
default : '' ,
description : 'Filters conversations from a specific mailbox' ,
2020-03-16 19:02:48 -07:00
} ,
{
displayName : 'Modified Since' ,
name : 'modifiedSince' ,
type : 'dateTime' ,
default : '' ,
description : 'Returns only conversations that were modified after this date' ,
} ,
{
displayName : 'Number' ,
name : 'number' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
} ,
description : 'Looks up conversation by conversation number' ,
} ,
2020-03-29 10:10:54 -07:00
{
displayName : 'Query' ,
name : 'query' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Advanced search <a href="https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/#query">Examples</a>' ,
2020-03-29 10:10:54 -07:00
} ,
2020-03-16 19:02:48 -07:00
{
displayName : 'Sort Field' ,
name : 'sortField' ,
type : 'options' ,
options : [
{
name : 'Created At' ,
value : 'createdAt' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Customer Email' ,
2020-03-16 19:02:48 -07:00
value : 'customerEmail' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Customer Name' ,
2020-03-16 19:02:48 -07:00
value : 'customerName' ,
} ,
{
name : 'Mailbox ID' ,
value : 'mailboxid' ,
} ,
{
name : 'Modified At' ,
value : 'modifiedAt' ,
} ,
{
name : 'Number' ,
value : 'number' ,
} ,
{
name : 'Score' ,
value : 'score' ,
} ,
{
name : 'Status' ,
value : 'status' ,
} ,
{
name : 'Subject' ,
value : 'subject' ,
} ,
] ,
default : '' ,
description : 'Sorts the result by specified field' ,
} ,
{
displayName : 'Sort Order' ,
name : 'sortOrder' ,
type : 'options' ,
options : [
{
name : 'ASC' ,
value : 'asc' ,
} ,
{
2020-03-30 00:20:40 -07:00
name : 'DESC' ,
2020-03-16 19:02:48 -07:00
value : 'desc' ,
} ,
] ,
default : 'desc' ,
} ,
{
2020-03-29 10:10:54 -07:00
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'active' ,
} ,
{
name : 'All' ,
value : 'all' ,
} ,
{
name : 'Closed' ,
value : 'closed' ,
} ,
{
name : 'Open' ,
value : 'open' ,
} ,
{
name : 'Pending' ,
value : 'pending' ,
} ,
{
name : 'Spam' ,
value : 'spam' ,
} ,
] ,
default : 'active' ,
description : 'Filter conversation by status' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-03-29 10:10:54 -07:00
name : 'tags' ,
type : 'multiOptions' ,
2020-03-16 19:02:48 -07:00
typeOptions : {
2020-03-29 10:10:54 -07:00
loadOptionsMethod : 'getTags' ,
2020-03-16 19:02:48 -07:00
} ,
2020-03-29 10:10:54 -07:00
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
2024-09-12 07:53:36 -07:00
'Filter conversation by tags. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2020-03-16 19:02:48 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;