2020-03-29 10:10:54 -07:00
|
|
|
|
import { INodeProperties } from 'n8n-workflow';
|
2020-03-16 19:02:48 -07:00
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
|
export const threadOperations: 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: {
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'Create',
|
|
|
|
|
value: 'create',
|
|
|
|
|
description: 'Create a new chat thread',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Get All',
|
|
|
|
|
value: 'getAll',
|
|
|
|
|
description: 'Get all chat threads',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
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 threadFields: INodeProperties[] = [
|
2020-03-16 19:02:48 -07:00
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* thread:create */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Conversation ID',
|
|
|
|
|
name: 'conversationId',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
operation: [
|
|
|
|
|
'create',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Type',
|
|
|
|
|
name: 'type',
|
|
|
|
|
type: 'options',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
operation: [
|
|
|
|
|
'create',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
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: '',
|
|
|
|
|
typeOptions: {
|
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
operation: [
|
|
|
|
|
'create',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
description: 'The chat text',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Additional Fields',
|
|
|
|
|
name: 'additionalFields',
|
|
|
|
|
type: 'collection',
|
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
|
default: {},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
operation: [
|
|
|
|
|
'create',
|
|
|
|
|
],
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
2020-03-29 10:10:54 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Created At',
|
|
|
|
|
name: 'createdAt',
|
|
|
|
|
type: 'dateTime',
|
|
|
|
|
default: '',
|
|
|
|
|
},
|
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: 'Draft',
|
|
|
|
|
name: 'draft',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
'/type': [
|
|
|
|
|
'note',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether a draft reply is created',
|
2020-03-16 19:02:48 -07:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Imported',
|
|
|
|
|
name: 'imported',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
default: false,
|
2022-06-20 07:54:01 -07:00
|
|
|
|
description: 'Whether no outgoing emails or notifications will be generated',
|
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: 'Attachments',
|
|
|
|
|
name: 'attachmentsUi',
|
|
|
|
|
placeholder: 'Add Attachments',
|
|
|
|
|
type: 'fixedCollection',
|
|
|
|
|
typeOptions: {
|
|
|
|
|
multipleValues: true,
|
|
|
|
|
},
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
operation: [
|
|
|
|
|
'create',
|
|
|
|
|
],
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
name: 'attachmentsValues',
|
|
|
|
|
displayName: 'Attachments Values',
|
|
|
|
|
values: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'FileName',
|
|
|
|
|
name: 'fileName',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'Attachment’s file name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Mime Type',
|
|
|
|
|
name: 'mimeType',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
description: 'Attachment’s mime type',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Data',
|
|
|
|
|
name: 'data',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
placeholder: 'ZXhhbXBsZSBmaWxl',
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Base64-encoded stream of data',
|
2020-03-16 19:02:48 -07:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'attachmentsBinary',
|
|
|
|
|
displayName: 'Attachments Binary',
|
|
|
|
|
values: [
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Property',
|
|
|
|
|
name: 'property',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: 'data',
|
|
|
|
|
description: 'Name of the binary properties which contain data which should be added to email as attachment',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
2022-04-22 09:29:51 -07:00
|
|
|
|
default: {},
|
2022-05-06 14:01:25 -07:00
|
|
|
|
description: 'Array of supported attachments to add to the message',
|
2020-03-16 19:02:48 -07:00
|
|
|
|
},
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
/* thread:getAll */
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
{
|
|
|
|
|
displayName: 'Conversation ID',
|
|
|
|
|
name: 'conversationId',
|
|
|
|
|
type: 'string',
|
|
|
|
|
default: '',
|
|
|
|
|
required: true,
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
operation: [
|
|
|
|
|
'getAll',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-03-29 19:08:00 -07:00
|
|
|
|
{
|
|
|
|
|
displayName: 'Return All',
|
|
|
|
|
name: 'returnAll',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
displayOptions: {
|
|
|
|
|
show: {
|
|
|
|
|
operation: [
|
|
|
|
|
'getAll',
|
|
|
|
|
],
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
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: {
|
|
|
|
|
operation: [
|
|
|
|
|
'getAll',
|
|
|
|
|
],
|
|
|
|
|
resource: [
|
|
|
|
|
'thread',
|
|
|
|
|
],
|
|
|
|
|
returnAll: [
|
|
|
|
|
false,
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
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
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
|
];
|