mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
⚡ Improved HelpScout-Nodes
This commit is contained in:
parent
6e6bb7781b
commit
83e6e8bf11
|
@ -1,4 +1,4 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const conversationOperations = [
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ export const conversationFields = [
|
|||
alwaysOpenEditWindow: true
|
||||
},
|
||||
default: '',
|
||||
description: 'The message text, '
|
||||
description: 'The message text.'
|
||||
},
|
||||
{
|
||||
displayName: 'Bcc',
|
||||
|
@ -428,6 +428,13 @@ export const conversationFields = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Assign To',
|
||||
name: 'assignTo',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'Filters conversations by assignee id',
|
||||
},
|
||||
{
|
||||
displayName: 'Embed',
|
||||
name: 'embed',
|
||||
|
@ -441,13 +448,6 @@ export const conversationFields = [
|
|||
default: '',
|
||||
description: 'Allows embedding/loading of sub-entities',
|
||||
},
|
||||
{
|
||||
displayName: 'Mailbox ID',
|
||||
name: 'mailbox',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Filters conversations from a specific mailbox',
|
||||
},
|
||||
{
|
||||
displayName: 'Folder ID',
|
||||
name: 'folder',
|
||||
|
@ -456,54 +456,11 @@ export const conversationFields = [
|
|||
description: 'Filters conversations from a specific folder id',
|
||||
},
|
||||
{
|
||||
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',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'Filter conversation by tags',
|
||||
},
|
||||
{
|
||||
displayName: 'Assign To',
|
||||
name: 'assignTo',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'Filters conversations by assignee id',
|
||||
displayName: 'Mailbox ID',
|
||||
name: 'mailbox',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Filters conversations from a specific mailbox',
|
||||
},
|
||||
{
|
||||
displayName: 'Modified Since',
|
||||
|
@ -522,6 +479,16 @@ export const conversationFields = [
|
|||
},
|
||||
description: 'Looks up conversation by conversation number',
|
||||
},
|
||||
{
|
||||
displayName: 'Query',
|
||||
name: 'query',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: 'Advanced search <a href="https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/#query">Examples</a>'
|
||||
},
|
||||
{
|
||||
displayName: 'Sort Field',
|
||||
name: 'sortField',
|
||||
|
@ -584,14 +551,47 @@ export const conversationFields = [
|
|||
default: 'desc',
|
||||
},
|
||||
{
|
||||
displayName: 'Query',
|
||||
name: 'query',
|
||||
type: 'string',
|
||||
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',
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tags',
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: '',
|
||||
description: 'Advanced search <a href="https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/#query">Examples</a>'
|
||||
default: [],
|
||||
description: 'Filter conversation by tags',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IDataObject } from "n8n-workflow";
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IConversation {
|
||||
assignTo?: number;
|
||||
|
@ -8,11 +8,11 @@ export interface IConversation {
|
|||
customer?: IDataObject;
|
||||
fields?: IDataObject[];
|
||||
imported?: boolean;
|
||||
mailboxId?: number; //
|
||||
status?: string; //
|
||||
subject?: string; //
|
||||
mailboxId?: number;
|
||||
status?: string;
|
||||
subject?: string;
|
||||
tags?: IDataObject[];
|
||||
threads?: IDataObject[];
|
||||
type?: string; //
|
||||
type?: string;
|
||||
user?: number;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const customerOperations = [
|
||||
{
|
||||
|
@ -18,11 +18,6 @@ export const customerOperations = [
|
|||
value: 'create',
|
||||
description: 'Create a new customer',
|
||||
},
|
||||
{
|
||||
name: 'Properties',
|
||||
value: 'properties',
|
||||
description: 'Get customer property definitions',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
|
@ -33,6 +28,11 @@ export const customerOperations = [
|
|||
value: 'getAll',
|
||||
description: 'Get all customers',
|
||||
},
|
||||
{
|
||||
name: 'Properties',
|
||||
value: 'properties',
|
||||
description: 'Get customer property definitions',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
|
@ -92,16 +92,6 @@ export const customerFields = [
|
|||
default: 1,
|
||||
description: `Customer’s age`,
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'background',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: `Notes`,
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
|
@ -151,6 +141,16 @@ export const customerFields = [
|
|||
default: '',
|
||||
description: 'Location of the customer.',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'background',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: `Notes`,
|
||||
},
|
||||
{
|
||||
displayName: 'Organization',
|
||||
name: 'organization',
|
||||
|
@ -267,39 +267,39 @@ export const customerFields = [
|
|||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'aim',
|
||||
name: 'AIM',
|
||||
value: 'aim',
|
||||
},
|
||||
{
|
||||
name: 'gtalk',
|
||||
name: 'Google Talk',
|
||||
value: 'gtalk',
|
||||
},
|
||||
{
|
||||
name: 'icq',
|
||||
name: 'ICQ',
|
||||
value: 'icq',
|
||||
},
|
||||
{
|
||||
name: 'msn',
|
||||
name: 'MSN',
|
||||
value: 'msn',
|
||||
},
|
||||
{
|
||||
name: 'other',
|
||||
name: 'Other',
|
||||
value: 'other',
|
||||
},
|
||||
{
|
||||
name: 'qq',
|
||||
name: 'QQ',
|
||||
value: 'qq',
|
||||
},
|
||||
{
|
||||
name: 'skype',
|
||||
name: 'Skype',
|
||||
value: 'skype',
|
||||
},
|
||||
{
|
||||
name: 'xmpp',
|
||||
name: 'XMPP',
|
||||
value: 'xmpp',
|
||||
},
|
||||
{
|
||||
name: 'yahoo',
|
||||
name: 'Yahoo',
|
||||
value: 'yahoo',
|
||||
},
|
||||
],
|
||||
|
@ -584,13 +584,6 @@ export const customerFields = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Mailbox ID',
|
||||
name: 'mailbox',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Filters customers from a specific mailbox',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
|
@ -605,6 +598,13 @@ export const customerFields = [
|
|||
default: '',
|
||||
description: 'Filters customers by last name',
|
||||
},
|
||||
{
|
||||
displayName: 'Mailbox ID',
|
||||
name: 'mailbox',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Filters customers from a specific mailbox',
|
||||
},
|
||||
{
|
||||
displayName: 'Modified Since',
|
||||
name: 'modifiedSince',
|
||||
|
@ -733,16 +733,6 @@ export const customerFields = [
|
|||
default: 1,
|
||||
description: `Customer’s age`,
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'background',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: `Notes`,
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
|
@ -792,6 +782,16 @@ export const customerFields = [
|
|||
default: '',
|
||||
description: 'Location of the customer.',
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
name: 'background',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: `Notes`,
|
||||
},
|
||||
{
|
||||
displayName: 'Organization',
|
||||
name: 'organization',
|
||||
|
@ -806,6 +806,6 @@ export const customerFields = [
|
|||
default: '',
|
||||
description: 'URL of the customer’s photo',
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IDataObject } from "n8n-workflow";
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface ICustomer {
|
||||
address?: IDataObject;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { OptionsWithUri } from 'request';
|
||||
import {
|
||||
IHookFunctions,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
|
@ -43,7 +43,8 @@ export async function helpscoutApiRequest(this: IExecuteFunctions | IExecuteSing
|
|||
return `${error.path} ${error.message}`;
|
||||
}).join('-')}`);
|
||||
}
|
||||
throw error;
|
||||
|
||||
throw new Error(`HelpScout error response [${error.statusCode}]: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,56 +3,57 @@ import {
|
|||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IBinaryKeyData,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeTypeDescription,
|
||||
INodeType,
|
||||
ILoadOptionsFunctions,
|
||||
INodePropertyOptions,
|
||||
IBinaryKeyData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
helpscoutApiRequest,
|
||||
helpscoutApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
countriesCodes
|
||||
} from './CountriesCodes';
|
||||
|
||||
import {
|
||||
conversationOperations,
|
||||
conversationFields,
|
||||
conversationOperations,
|
||||
} from './ConversationDescription';
|
||||
|
||||
import {
|
||||
customerOperations,
|
||||
customerFields,
|
||||
customerOperations,
|
||||
} from './CustomerDescription';
|
||||
|
||||
import {
|
||||
mailboxOperations,
|
||||
mailboxFields,
|
||||
} from './MailboxDescription';
|
||||
|
||||
import {
|
||||
threadOperations,
|
||||
threadFields,
|
||||
} from './ThreadDescription';
|
||||
|
||||
import {
|
||||
ICustomer,
|
||||
} from './CustomerInterface';
|
||||
|
||||
import {
|
||||
IConversation,
|
||||
} from './ConversationInterface';
|
||||
} from './ConversationInterface';
|
||||
|
||||
import {
|
||||
IThread,
|
||||
import {
|
||||
helpscoutApiRequest,
|
||||
helpscoutApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
mailboxFields,
|
||||
mailboxOperations,
|
||||
} from './MailboxDescription';
|
||||
|
||||
import {
|
||||
threadFields,
|
||||
threadOperations,
|
||||
} from './ThreadDescription';
|
||||
|
||||
import {
|
||||
IAttachment,
|
||||
} from './ThreadInterface';
|
||||
IThread,
|
||||
} from './ThreadInterface';
|
||||
|
||||
import {
|
||||
countriesCodes
|
||||
} from './CountriesCodes';
|
||||
|
||||
export class HelpScout implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
|
|
|
@ -4,10 +4,10 @@ import {
|
|||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
INodeTypeDescription,
|
||||
INodeType,
|
||||
IWebhookResponseData,
|
||||
IDataObject,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IWebhookResponseData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
|
@ -51,52 +51,53 @@ export class HelpScoutTrigger implements INodeType {
|
|||
name: 'events',
|
||||
type: 'multiOptions',
|
||||
options: [
|
||||
|
||||
{
|
||||
name: 'convo.agent.reply.created',
|
||||
value: 'convo.agent.reply.created',
|
||||
},
|
||||
{
|
||||
name: 'convo.assigned',
|
||||
name: 'Conversation - Assigned',
|
||||
value: 'convo.assigned',
|
||||
},
|
||||
{
|
||||
name: 'convo.created',
|
||||
name: 'Conversation - Created',
|
||||
value: 'convo.created',
|
||||
},
|
||||
{
|
||||
name: 'convo.customer.reply.created',
|
||||
value: 'convo.customer.reply.created',
|
||||
},
|
||||
{
|
||||
name: 'convo.deleted',
|
||||
name: 'Conversation - Deleted',
|
||||
value: 'convo.deleted',
|
||||
},
|
||||
{
|
||||
name: 'convo.merged',
|
||||
name: 'Conversation - Merged',
|
||||
value: 'convo.merged',
|
||||
},
|
||||
{
|
||||
name: 'convo.moved',
|
||||
name: 'Conversation - Moved',
|
||||
value: 'convo.moved',
|
||||
},
|
||||
{
|
||||
name: 'convo.note.created',
|
||||
value: 'convo.note.created',
|
||||
},
|
||||
{
|
||||
name: 'convo.status',
|
||||
name: 'Conversation - Status',
|
||||
value: 'convo.status',
|
||||
},
|
||||
{
|
||||
name: 'convo.tags',
|
||||
name: 'Conversation - Tags',
|
||||
value: 'convo.tags',
|
||||
},
|
||||
{
|
||||
name: 'customer.created',
|
||||
name: 'Conversation Agent Reply - Created',
|
||||
value: 'convo.agent.reply.created',
|
||||
},
|
||||
{
|
||||
name: 'Conversation Customer Reply - Created',
|
||||
value: 'convo.customer.reply.created',
|
||||
},
|
||||
{
|
||||
name: 'Conversation Note - Created',
|
||||
value: 'convo.note.created',
|
||||
},
|
||||
{
|
||||
name: 'Customer - Created',
|
||||
value: 'customer.created',
|
||||
},
|
||||
{
|
||||
name: 'satisfaction.ratings',
|
||||
name: 'Rating - Received',
|
||||
value: 'satisfaction.ratings',
|
||||
},
|
||||
],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const mailboxOperations = [
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const threadOperations = [
|
||||
{
|
||||
|
@ -128,6 +128,12 @@ export const threadFields = [
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Created At',
|
||||
name: 'createdAt',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email',
|
||||
name: 'customerEmail',
|
||||
|
@ -161,12 +167,6 @@ export const threadFields = [
|
|||
default: false,
|
||||
description: 'When imported is set to true, no outgoing emails or notifications will be generated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Created At',
|
||||
name: 'createdAt',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IDataObject } from "n8n-workflow";
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IAttachment {
|
||||
fileName?: string;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 870 B |
|
@ -198,8 +198,8 @@
|
|||
"@types/gm": "^1.18.2",
|
||||
"@types/imap-simple": "^4.2.0",
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/lodash.set": "^4.3.6",
|
||||
"@types/moment-timezone": "^0.5.12",
|
||||
"@types/lodash.set": "^4.3.6",
|
||||
"@types/moment-timezone": "^0.5.12",
|
||||
"@types/mongodb": "^3.3.6",
|
||||
"@types/node": "^10.10.1",
|
||||
"@types/nodemailer": "^4.6.5",
|
||||
|
@ -225,8 +225,8 @@
|
|||
"imap-simple": "^4.3.0",
|
||||
"lodash.get": "^4.4.2",
|
||||
"lodash.set": "^4.3.2",
|
||||
"lodash.unset": "^4.5.2",
|
||||
"moment-timezone": "0.5.28",
|
||||
"lodash.unset": "^4.5.2",
|
||||
"moment-timezone": "0.5.28",
|
||||
"mongodb": "^3.3.2",
|
||||
"mysql2": "^2.0.1",
|
||||
"n8n-core": "~0.20.0",
|
||||
|
|
Loading…
Reference in a new issue