n8n-nodes-richpanel 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
|
|
2
2
|
export declare class RichpanelTool implements INodeType {
|
|
3
3
|
description: INodeTypeDescription;
|
|
4
4
|
supplyData(this: ISupplyDataFunctions): Promise<SupplyData>;
|
|
@@ -9,7 +9,7 @@ class RichpanelTool {
|
|
|
9
9
|
icon: 'file:richpanel-logo.png',
|
|
10
10
|
group: ['transform'],
|
|
11
11
|
version: 1,
|
|
12
|
-
description: 'Use Richpanel
|
|
12
|
+
description: 'Use Richpanel with AI Agents - enable AI to manage support conversations, customers, and orders',
|
|
13
13
|
defaults: {
|
|
14
14
|
name: 'Richpanel Tool',
|
|
15
15
|
},
|
|
@@ -44,7 +44,7 @@ class RichpanelTool {
|
|
|
44
44
|
},
|
|
45
45
|
properties: [
|
|
46
46
|
{
|
|
47
|
-
displayName: '
|
|
47
|
+
displayName: 'Connect this node to an AI Agent to give it access to Richpanel operations. The AI can create tickets, look up customers, check orders, and more.',
|
|
48
48
|
name: 'notice',
|
|
49
49
|
type: 'notice',
|
|
50
50
|
default: '',
|
|
@@ -53,48 +53,48 @@ class RichpanelTool {
|
|
|
53
53
|
displayName: 'Available Operations',
|
|
54
54
|
name: 'operations',
|
|
55
55
|
type: 'multiOptions',
|
|
56
|
-
description: 'Select which operations the AI agent can perform',
|
|
57
|
-
default: ['getConversation', 'createConversation', 'getCustomer'],
|
|
56
|
+
description: 'Select which Richpanel operations the AI agent can perform',
|
|
57
|
+
default: ['getConversation', 'createConversation', 'getCustomer', 'getOrder'],
|
|
58
58
|
options: [
|
|
59
59
|
{
|
|
60
60
|
name: 'Create Conversation',
|
|
61
61
|
value: 'createConversation',
|
|
62
|
-
description: '
|
|
62
|
+
description: 'Let AI create new support tickets',
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
name: 'Get Conversation',
|
|
66
66
|
value: 'getConversation',
|
|
67
|
-
description: '
|
|
67
|
+
description: 'Let AI retrieve conversation details',
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
name: 'Update Conversation',
|
|
71
71
|
value: 'updateConversation',
|
|
72
|
-
description: '
|
|
72
|
+
description: 'Let AI update conversation status or priority',
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
name: 'Get Customer',
|
|
76
76
|
value: 'getCustomer',
|
|
77
|
-
description: '
|
|
77
|
+
description: 'Let AI look up customer information',
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
name: 'Create/Update Customer',
|
|
81
81
|
value: 'upsertCustomer',
|
|
82
|
-
description: '
|
|
82
|
+
description: 'Let AI create or update customer records',
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
name: 'Get Order',
|
|
86
86
|
value: 'getOrder',
|
|
87
|
-
description: '
|
|
87
|
+
description: 'Let AI retrieve order information',
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
name: 'Add Tags
|
|
90
|
+
name: 'Add Tags',
|
|
91
91
|
value: 'addTags',
|
|
92
|
-
description: '
|
|
92
|
+
description: 'Let AI add tags to conversations',
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
name: 'List Users',
|
|
96
96
|
value: 'listUsers',
|
|
97
|
-
description: '
|
|
97
|
+
description: 'Let AI see available support agents',
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
},
|
|
@@ -102,296 +102,205 @@ class RichpanelTool {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
async supplyData() {
|
|
105
|
-
const operations = this.getNodeParameter('operations', 0);
|
|
106
|
-
const
|
|
107
|
-
//
|
|
105
|
+
const operations = this.getNodeParameter('operations', 0, []);
|
|
106
|
+
const toolDefinitions = [];
|
|
107
|
+
// Create Conversation Tool
|
|
108
108
|
if (operations.includes('createConversation')) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
type: 'string',
|
|
119
|
-
description: 'The message content from the customer',
|
|
120
|
-
},
|
|
121
|
-
customerEmail: {
|
|
122
|
-
type: 'string',
|
|
123
|
-
description: 'Customer email address',
|
|
124
|
-
},
|
|
125
|
-
subject: {
|
|
126
|
-
type: 'string',
|
|
127
|
-
description: 'Subject line for the conversation',
|
|
128
|
-
},
|
|
129
|
-
priority: {
|
|
130
|
-
type: 'string',
|
|
131
|
-
enum: ['HIGH', 'LOW'],
|
|
132
|
-
description: 'Priority level of the conversation',
|
|
133
|
-
},
|
|
109
|
+
toolDefinitions.push({
|
|
110
|
+
name: 'richpanel_create_conversation',
|
|
111
|
+
description: 'Create a new support conversation/ticket in Richpanel. Use this when a customer needs help, reports an issue, or has a question that needs tracking.',
|
|
112
|
+
schema: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
properties: {
|
|
115
|
+
messageBody: {
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'The customer message content or issue description',
|
|
134
118
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
via: {
|
|
149
|
-
channel: 'email',
|
|
150
|
-
source: {
|
|
151
|
-
from: { address: params.customerEmail },
|
|
152
|
-
to: { address: 'support@company.com' },
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
subject: params.subject || 'Support Request',
|
|
156
|
-
priority: params.priority || 'LOW',
|
|
157
|
-
},
|
|
119
|
+
customerEmail: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'Customer email address',
|
|
122
|
+
},
|
|
123
|
+
subject: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
description: 'Subject line for the conversation/ticket',
|
|
126
|
+
},
|
|
127
|
+
priority: {
|
|
128
|
+
type: 'string',
|
|
129
|
+
enum: ['HIGH', 'LOW'],
|
|
130
|
+
description: 'Priority level (HIGH for urgent issues, LOW for general questions)',
|
|
158
131
|
},
|
|
159
|
-
|
|
160
|
-
|
|
132
|
+
},
|
|
133
|
+
required: ['messageBody', 'customerEmail'],
|
|
161
134
|
},
|
|
162
135
|
});
|
|
163
136
|
}
|
|
137
|
+
// Get Conversation Tool
|
|
164
138
|
if (operations.includes('getConversation')) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
type: 'string',
|
|
175
|
-
description: 'The unique ID of the conversation',
|
|
176
|
-
},
|
|
139
|
+
toolDefinitions.push({
|
|
140
|
+
name: 'richpanel_get_conversation',
|
|
141
|
+
description: 'Retrieve details about an existing conversation/ticket by ID. Use this to check ticket status, see assigned agent, read conversation history, or verify if an issue is resolved.',
|
|
142
|
+
schema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: {
|
|
145
|
+
conversationId: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
description: 'The unique ID of the conversation/ticket',
|
|
177
148
|
},
|
|
178
|
-
required: ['conversationId'],
|
|
179
149
|
},
|
|
180
|
-
|
|
181
|
-
implementation: async (params) => {
|
|
182
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
183
|
-
method: 'GET',
|
|
184
|
-
url: `/tickets/${params.conversationId}`,
|
|
185
|
-
json: true,
|
|
186
|
-
});
|
|
150
|
+
required: ['conversationId'],
|
|
187
151
|
},
|
|
188
152
|
});
|
|
189
153
|
}
|
|
154
|
+
// Update Conversation Tool
|
|
190
155
|
if (operations.includes('updateConversation')) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
enum: ['HIGH', 'LOW'],
|
|
211
|
-
description: 'New priority level',
|
|
212
|
-
},
|
|
156
|
+
toolDefinitions.push({
|
|
157
|
+
name: 'richpanel_update_conversation',
|
|
158
|
+
description: 'Update conversation properties like status or priority. Use this to close resolved tickets, change priority levels, or update conversation state.',
|
|
159
|
+
schema: {
|
|
160
|
+
type: 'object',
|
|
161
|
+
properties: {
|
|
162
|
+
conversationId: {
|
|
163
|
+
type: 'string',
|
|
164
|
+
description: 'The unique ID of the conversation to update',
|
|
165
|
+
},
|
|
166
|
+
status: {
|
|
167
|
+
type: 'string',
|
|
168
|
+
enum: ['OPEN', 'CLOSED'],
|
|
169
|
+
description: 'New status (CLOSED when issue is resolved, OPEN otherwise)',
|
|
170
|
+
},
|
|
171
|
+
priority: {
|
|
172
|
+
type: 'string',
|
|
173
|
+
enum: ['HIGH', 'LOW'],
|
|
174
|
+
description: 'New priority level',
|
|
213
175
|
},
|
|
214
|
-
required: ['conversationId'],
|
|
215
176
|
},
|
|
216
|
-
|
|
217
|
-
implementation: async (params) => {
|
|
218
|
-
const body = { ticket: {} };
|
|
219
|
-
if (params.status)
|
|
220
|
-
body.ticket.status = params.status;
|
|
221
|
-
if (params.priority)
|
|
222
|
-
body.ticket.priority = params.priority;
|
|
223
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
224
|
-
method: 'PUT',
|
|
225
|
-
url: `/tickets/${params.conversationId}`,
|
|
226
|
-
body,
|
|
227
|
-
json: true,
|
|
228
|
-
});
|
|
177
|
+
required: ['conversationId'],
|
|
229
178
|
},
|
|
230
179
|
});
|
|
231
180
|
}
|
|
181
|
+
// Get Customer Tool
|
|
232
182
|
if (operations.includes('getCustomer')) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
description: 'Type of identifier (email or phone)',
|
|
249
|
-
default: 'email',
|
|
250
|
-
},
|
|
183
|
+
toolDefinitions.push({
|
|
184
|
+
name: 'richpanel_get_customer',
|
|
185
|
+
description: 'Retrieve customer information by email or phone number. Use this to look up customer details, see order history, check customer status, or verify customer information.',
|
|
186
|
+
schema: {
|
|
187
|
+
type: 'object',
|
|
188
|
+
properties: {
|
|
189
|
+
identifier: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
description: 'Customer email address or phone number',
|
|
192
|
+
},
|
|
193
|
+
type: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
enum: ['email', 'phone'],
|
|
196
|
+
description: 'Type of identifier (email or phone)',
|
|
197
|
+
default: 'email',
|
|
251
198
|
},
|
|
252
|
-
required: ['identifier'],
|
|
253
199
|
},
|
|
254
|
-
|
|
255
|
-
implementation: async (params) => {
|
|
256
|
-
const type = params.type || 'email';
|
|
257
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
258
|
-
method: 'GET',
|
|
259
|
-
url: `/customers/${type}/${params.identifier}`,
|
|
260
|
-
json: true,
|
|
261
|
-
});
|
|
200
|
+
required: ['identifier'],
|
|
262
201
|
},
|
|
263
202
|
});
|
|
264
203
|
}
|
|
204
|
+
// Create/Update Customer Tool
|
|
265
205
|
if (operations.includes('upsertCustomer')) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
type: 'string',
|
|
296
|
-
description: 'Customer country',
|
|
297
|
-
},
|
|
206
|
+
toolDefinitions.push({
|
|
207
|
+
name: 'richpanel_create_update_customer',
|
|
208
|
+
description: 'Create a new customer or update existing customer information. Use this when a customer provides updated details or to add a new customer to the system.',
|
|
209
|
+
schema: {
|
|
210
|
+
type: 'object',
|
|
211
|
+
properties: {
|
|
212
|
+
email: {
|
|
213
|
+
type: 'string',
|
|
214
|
+
description: 'Customer email address (required)',
|
|
215
|
+
},
|
|
216
|
+
firstName: {
|
|
217
|
+
type: 'string',
|
|
218
|
+
description: 'Customer first name',
|
|
219
|
+
},
|
|
220
|
+
lastName: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
description: 'Customer last name',
|
|
223
|
+
},
|
|
224
|
+
phone: {
|
|
225
|
+
type: 'string',
|
|
226
|
+
description: 'Customer phone number',
|
|
227
|
+
},
|
|
228
|
+
city: {
|
|
229
|
+
type: 'string',
|
|
230
|
+
description: 'Customer city',
|
|
231
|
+
},
|
|
232
|
+
country: {
|
|
233
|
+
type: 'string',
|
|
234
|
+
description: 'Customer country',
|
|
298
235
|
},
|
|
299
|
-
required: ['email'],
|
|
300
236
|
},
|
|
301
|
-
|
|
302
|
-
implementation: async (params) => {
|
|
303
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
304
|
-
method: 'POST',
|
|
305
|
-
url: '/customers',
|
|
306
|
-
body: params,
|
|
307
|
-
json: true,
|
|
308
|
-
});
|
|
237
|
+
required: ['email'],
|
|
309
238
|
},
|
|
310
239
|
});
|
|
311
240
|
}
|
|
241
|
+
// Get Order Tool
|
|
312
242
|
if (operations.includes('getOrder')) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
type: 'string',
|
|
323
|
-
description: 'The unique order ID',
|
|
324
|
-
},
|
|
243
|
+
toolDefinitions.push({
|
|
244
|
+
name: 'richpanel_get_order',
|
|
245
|
+
description: 'Retrieve order information by order ID. Use this when a customer asks about order status, shipping, tracking, or order details.',
|
|
246
|
+
schema: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
orderId: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
description: 'The unique order ID/number',
|
|
325
252
|
},
|
|
326
|
-
required: ['orderId'],
|
|
327
253
|
},
|
|
328
|
-
|
|
329
|
-
implementation: async (params) => {
|
|
330
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
331
|
-
method: 'GET',
|
|
332
|
-
url: `/order/${params.orderId}`,
|
|
333
|
-
json: true,
|
|
334
|
-
});
|
|
254
|
+
required: ['orderId'],
|
|
335
255
|
},
|
|
336
256
|
});
|
|
337
257
|
}
|
|
258
|
+
// Add Tags Tool
|
|
338
259
|
if (operations.includes('addTags')) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
260
|
+
toolDefinitions.push({
|
|
261
|
+
name: 'richpanel_add_tags',
|
|
262
|
+
description: 'Add tags to a conversation for categorization and organization. Use this to tag tickets by issue type, urgency, department, or any other category.',
|
|
263
|
+
schema: {
|
|
264
|
+
type: 'object',
|
|
265
|
+
properties: {
|
|
266
|
+
conversationId: {
|
|
267
|
+
type: 'string',
|
|
268
|
+
description: 'The conversation ID to add tags to',
|
|
269
|
+
},
|
|
270
|
+
tags: {
|
|
271
|
+
type: 'array',
|
|
272
|
+
items: {
|
|
348
273
|
type: 'string',
|
|
349
|
-
description: 'The conversation ID to add tags to',
|
|
350
|
-
},
|
|
351
|
-
tags: {
|
|
352
|
-
type: 'array',
|
|
353
|
-
items: {
|
|
354
|
-
type: 'string',
|
|
355
|
-
},
|
|
356
|
-
description: 'Array of tag names to add',
|
|
357
274
|
},
|
|
275
|
+
description: 'Array of tag names (e.g., ["billing", "urgent", "refund"])',
|
|
358
276
|
},
|
|
359
|
-
required: ['conversationId', 'tags'],
|
|
360
277
|
},
|
|
361
|
-
|
|
362
|
-
implementation: async (params) => {
|
|
363
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
364
|
-
method: 'PUT',
|
|
365
|
-
url: `/tickets/${params.conversationId}/add-tags`,
|
|
366
|
-
body: {
|
|
367
|
-
tags: params.tags,
|
|
368
|
-
},
|
|
369
|
-
json: true,
|
|
370
|
-
});
|
|
278
|
+
required: ['conversationId', 'tags'],
|
|
371
279
|
},
|
|
372
280
|
});
|
|
373
281
|
}
|
|
282
|
+
// List Users Tool
|
|
374
283
|
if (operations.includes('listUsers')) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
type: 'object',
|
|
382
|
-
properties: {},
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
|
-
implementation: async () => {
|
|
386
|
-
return await this.helpers.httpRequestWithAuthentication.call(this, 'richpanelApi', {
|
|
387
|
-
method: 'GET',
|
|
388
|
-
url: '/users',
|
|
389
|
-
json: true,
|
|
390
|
-
});
|
|
284
|
+
toolDefinitions.push({
|
|
285
|
+
name: 'richpanel_list_users',
|
|
286
|
+
description: 'Get a list of all support agents/users in Richpanel. Use this when a customer asks to speak with an agent, or to find available support staff.',
|
|
287
|
+
schema: {
|
|
288
|
+
type: 'object',
|
|
289
|
+
properties: {},
|
|
391
290
|
},
|
|
392
291
|
});
|
|
393
292
|
}
|
|
394
|
-
|
|
293
|
+
// Return tool definitions for AI agent
|
|
294
|
+
return {
|
|
295
|
+
response: toolDefinitions.map((tool) => ({
|
|
296
|
+
type: 'function',
|
|
297
|
+
function: {
|
|
298
|
+
name: tool.name,
|
|
299
|
+
description: tool.description,
|
|
300
|
+
parameters: tool.schema,
|
|
301
|
+
},
|
|
302
|
+
})),
|
|
303
|
+
};
|
|
395
304
|
}
|
|
396
305
|
}
|
|
397
306
|
exports.RichpanelTool = RichpanelTool;
|
package/package.json
CHANGED