n8n-nodes-bgos 0.3.0
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.
- package/LICENSE +21 -0
- package/LICENSE.md +21 -0
- package/README.md +63 -0
- package/dist/credentials/BgosApi.credentials.d.ts +9 -0
- package/dist/credentials/BgosApi.credentials.js +42 -0
- package/dist/icons/bgos.png +0 -0
- package/dist/icons/bgos.svg +5 -0
- package/dist/nodes/BGOSAction/BGOSAction.node.d.ts +5 -0
- package/dist/nodes/BGOSAction/BGOSAction.node.js +141 -0
- package/dist/nodes/BGOSAction/EventTypes.d.ts +21 -0
- package/dist/nodes/BGOSAction/EventTypes.js +25 -0
- package/dist/nodes/BGOSAction/agentWebhook.d.ts +1 -0
- package/dist/nodes/BGOSAction/agentWebhook.js +66 -0
- package/dist/nodes/BGOSAction/handler/eventHandler.d.ts +12 -0
- package/dist/nodes/BGOSAction/handler/eventHandler.js +137 -0
- package/dist/nodes/BGOSAction/rateLimiter.d.ts +2 -0
- package/dist/nodes/BGOSAction/rateLimiter.js +37 -0
- package/dist/nodes/BGOSAction/techWebhook.d.ts +43 -0
- package/dist/nodes/BGOSAction/techWebhook.js +133 -0
- package/dist/nodes/Bgos/Bgos.node.d.ts +4 -0
- package/dist/nodes/Bgos/Bgos.node.js +64 -0
- package/dist/nodes/Bgos/resources/assistant/index.d.ts +3 -0
- package/dist/nodes/Bgos/resources/assistant/index.js +362 -0
- package/dist/nodes/Bgos/resources/chat/index.d.ts +3 -0
- package/dist/nodes/Bgos/resources/chat/index.js +286 -0
- package/dist/nodes/Bgos/resources/message/index.d.ts +3 -0
- package/dist/nodes/Bgos/resources/message/index.js +881 -0
- package/dist/nodes/Bgos/resources/scheduledTask/index.d.ts +3 -0
- package/dist/nodes/Bgos/resources/scheduledTask/index.js +85 -0
- package/dist/nodes/Bgos/resources/user/index.d.ts +3 -0
- package/dist/nodes/Bgos/resources/user/index.js +158 -0
- package/dist/nodes/BgosTrigger/BgosTrigger.node.d.ts +12 -0
- package/dist/nodes/BgosTrigger/BgosTrigger.node.js +142 -0
- package/dist/nodes/BgosTrigger/stubs.d.ts +4 -0
- package/dist/nodes/BgosTrigger/stubs.js +86 -0
- package/package.json +71 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface BgosApiOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createAssistant(options: BgosApiOptions, userId: string, assistantData: Record<string, unknown>): Promise<unknown>;
|
|
6
|
+
export declare function updateAssistant(options: BgosApiOptions, userId: string, assistantId: string | number, assistantData: Record<string, unknown>): Promise<unknown>;
|
|
7
|
+
export declare function deleteAssistant(options: BgosApiOptions, _userId: string, assistantId: string | number): Promise<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function renameChat(options: BgosApiOptions, userId: string, chatId: string | number, newTitle: string): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function deleteChat(options: BgosApiOptions, _userId: string, chatId: string | number): Promise<{
|
|
14
|
+
success: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function saveChatHistory(options: BgosApiOptions, _userId: string, messages: unknown[]): Promise<unknown>;
|
|
17
|
+
export declare function sendMessageToBackend(options: BgosApiOptions, payload: {
|
|
18
|
+
assistantId: string | number;
|
|
19
|
+
chatId: string | number;
|
|
20
|
+
sender?: string;
|
|
21
|
+
text?: string | null;
|
|
22
|
+
options?: unknown[];
|
|
23
|
+
files?: unknown[];
|
|
24
|
+
isCode?: boolean | null;
|
|
25
|
+
artifactCode?: string | null;
|
|
26
|
+
isArticle?: boolean | null;
|
|
27
|
+
articleText?: string | null;
|
|
28
|
+
isAudioMessage?: boolean | null;
|
|
29
|
+
audioData?: string | null;
|
|
30
|
+
audioMimeType?: string | null;
|
|
31
|
+
audioDuration?: number | null;
|
|
32
|
+
isMixedAttachments?: boolean | null;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}): Promise<unknown>;
|
|
35
|
+
export declare function reportCallbackResult(options: BgosApiOptions, payload: {
|
|
36
|
+
messageId: number | string;
|
|
37
|
+
optionId: number | string;
|
|
38
|
+
userId: string;
|
|
39
|
+
success: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
}>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createAssistant = createAssistant;
|
|
7
|
+
exports.updateAssistant = updateAssistant;
|
|
8
|
+
exports.deleteAssistant = deleteAssistant;
|
|
9
|
+
exports.renameChat = renameChat;
|
|
10
|
+
exports.deleteChat = deleteChat;
|
|
11
|
+
exports.saveChatHistory = saveChatHistory;
|
|
12
|
+
exports.sendMessageToBackend = sendMessageToBackend;
|
|
13
|
+
exports.reportCallbackResult = reportCallbackResult;
|
|
14
|
+
/**
|
|
15
|
+
* HTTP calls to BGOS backend REST API (api/v1/assistants, chats, messages).
|
|
16
|
+
*/
|
|
17
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
18
|
+
function buildHeaders(apiKey) {
|
|
19
|
+
const headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
20
|
+
if (apiKey)
|
|
21
|
+
headers.Authorization = `Bearer ${apiKey}`;
|
|
22
|
+
return headers;
|
|
23
|
+
}
|
|
24
|
+
async function createAssistant(options, userId, assistantData) {
|
|
25
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/assistants`;
|
|
26
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: buildHeaders(options.apiKey),
|
|
29
|
+
body: JSON.stringify({ userId, ...assistantData }),
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok)
|
|
32
|
+
throw new Error(`Failed to create assistant: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
33
|
+
return response.json();
|
|
34
|
+
}
|
|
35
|
+
async function updateAssistant(options, userId, assistantId, assistantData) {
|
|
36
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/assistants/${assistantId}`;
|
|
37
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
38
|
+
method: 'PATCH',
|
|
39
|
+
headers: buildHeaders(options.apiKey),
|
|
40
|
+
body: JSON.stringify({ userId, ...assistantData }),
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok)
|
|
43
|
+
throw new Error(`Failed to update assistant: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
44
|
+
return response.json();
|
|
45
|
+
}
|
|
46
|
+
async function deleteAssistant(options, _userId, assistantId) {
|
|
47
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/assistants/${assistantId}`;
|
|
48
|
+
const response = await (0, node_fetch_1.default)(url, { method: 'DELETE', headers: buildHeaders(options.apiKey) });
|
|
49
|
+
if (!response.ok)
|
|
50
|
+
throw new Error(`Failed to delete assistant: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
51
|
+
return { success: true };
|
|
52
|
+
}
|
|
53
|
+
async function renameChat(options, userId, chatId, newTitle) {
|
|
54
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/chats/${chatId}/title`;
|
|
55
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
56
|
+
method: 'PATCH',
|
|
57
|
+
headers: buildHeaders(options.apiKey),
|
|
58
|
+
body: JSON.stringify({ userId, title: newTitle }),
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok)
|
|
61
|
+
throw new Error(`Failed to rename chat: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
62
|
+
return { success: true };
|
|
63
|
+
}
|
|
64
|
+
async function deleteChat(options, _userId, chatId) {
|
|
65
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/chats/${chatId}`;
|
|
66
|
+
const response = await (0, node_fetch_1.default)(url, { method: 'DELETE', headers: buildHeaders(options.apiKey) });
|
|
67
|
+
if (!response.ok)
|
|
68
|
+
throw new Error(`Failed to delete chat: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
69
|
+
return { success: true };
|
|
70
|
+
}
|
|
71
|
+
async function saveChatHistory(options, _userId, messages) {
|
|
72
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/messages/bulk`;
|
|
73
|
+
const dtos = messages.map((m) => ({
|
|
74
|
+
chatId: Number(m.chat_id ?? m.chatId ?? m.message?.chatId) || 0,
|
|
75
|
+
sender: (m.sender ?? m.message?.sender ?? 'user'),
|
|
76
|
+
text: (m.text ?? m.message?.text ?? ''),
|
|
77
|
+
sentDate: (m.sentDate ?? m.sent_date ?? m.message?.sentDate ?? m.timestamp ?? new Date().toISOString()),
|
|
78
|
+
}));
|
|
79
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: buildHeaders(options.apiKey),
|
|
82
|
+
body: JSON.stringify(dtos),
|
|
83
|
+
});
|
|
84
|
+
if (!response.ok)
|
|
85
|
+
throw new Error(`Failed to save chat history: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
86
|
+
return response.json();
|
|
87
|
+
}
|
|
88
|
+
async function sendMessageToBackend(options, payload) {
|
|
89
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/send-message`;
|
|
90
|
+
const body = {
|
|
91
|
+
assistantId: String(payload.assistantId),
|
|
92
|
+
chatId: Number(payload.chatId),
|
|
93
|
+
sender: payload.sender ?? 'assistant',
|
|
94
|
+
text: payload.text ?? null,
|
|
95
|
+
hasAttachment: Array.isArray(payload.files) && payload.files.length > 0,
|
|
96
|
+
isCode: payload.isCode ?? null,
|
|
97
|
+
artifactCode: payload.artifactCode ?? null,
|
|
98
|
+
isArticle: payload.isArticle ?? null,
|
|
99
|
+
articleText: payload.articleText ?? null,
|
|
100
|
+
isAudioMessage: payload.isAudioMessage ?? null,
|
|
101
|
+
audioData: payload.audioData ?? null,
|
|
102
|
+
audioMimeType: payload.audioMimeType ?? null,
|
|
103
|
+
audioDuration: payload.audioDuration ?? null,
|
|
104
|
+
isMixedAttachments: payload.isMixedAttachments ?? null,
|
|
105
|
+
options: payload.options ?? [],
|
|
106
|
+
files: payload.files ?? [],
|
|
107
|
+
};
|
|
108
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: buildHeaders(options.apiKey),
|
|
111
|
+
body: JSON.stringify(body),
|
|
112
|
+
});
|
|
113
|
+
if (!response.ok)
|
|
114
|
+
throw new Error(`Failed to send message to BGOS backend: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
115
|
+
return response.json();
|
|
116
|
+
}
|
|
117
|
+
async function reportCallbackResult(options, payload) {
|
|
118
|
+
const url = `${options.baseUrl.replace(/\/$/, '')}/api/v1/messages/callback-result`;
|
|
119
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
headers: buildHeaders(options.apiKey),
|
|
122
|
+
body: JSON.stringify({
|
|
123
|
+
messageId: Number(payload.messageId),
|
|
124
|
+
optionId: Number(payload.optionId),
|
|
125
|
+
userId: payload.userId,
|
|
126
|
+
success: payload.success,
|
|
127
|
+
error: payload.error,
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
if (!response.ok)
|
|
131
|
+
throw new Error(`Failed to report callback result: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
132
|
+
return response.json();
|
|
133
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bgos = void 0;
|
|
4
|
+
const message_1 = require("./resources/message");
|
|
5
|
+
const chat_1 = require("./resources/chat");
|
|
6
|
+
const assistant_1 = require("./resources/assistant");
|
|
7
|
+
const user_1 = require("./resources/user");
|
|
8
|
+
const scheduledTask_1 = require("./resources/scheduledTask");
|
|
9
|
+
class Bgos {
|
|
10
|
+
description = {
|
|
11
|
+
displayName: 'BGOS',
|
|
12
|
+
name: 'bgos',
|
|
13
|
+
icon: 'file:../../icons/bgos.png',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
17
|
+
description: 'Interact with the BGOS AI assistant platform',
|
|
18
|
+
defaults: {
|
|
19
|
+
name: 'BGOS',
|
|
20
|
+
},
|
|
21
|
+
inputs: ['main'],
|
|
22
|
+
outputs: ['main'],
|
|
23
|
+
credentials: [
|
|
24
|
+
{
|
|
25
|
+
name: 'bgosApi',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
requestDefaults: {
|
|
30
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: 'application/json',
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
properties: [
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Resource',
|
|
39
|
+
name: 'resource',
|
|
40
|
+
type: 'options',
|
|
41
|
+
noDataExpression: true,
|
|
42
|
+
options: [
|
|
43
|
+
{ name: 'Assistant', value: 'assistant' },
|
|
44
|
+
{ name: 'Chat', value: 'chat' },
|
|
45
|
+
{ name: 'Message', value: 'message' },
|
|
46
|
+
{ name: 'Scheduled Task', value: 'scheduledTask' },
|
|
47
|
+
{ name: 'User', value: 'user' },
|
|
48
|
+
],
|
|
49
|
+
default: 'message',
|
|
50
|
+
},
|
|
51
|
+
...message_1.messageOperations,
|
|
52
|
+
...message_1.messageFields,
|
|
53
|
+
...chat_1.chatOperations,
|
|
54
|
+
...chat_1.chatFields,
|
|
55
|
+
...assistant_1.assistantOperations,
|
|
56
|
+
...assistant_1.assistantFields,
|
|
57
|
+
...user_1.userOperations,
|
|
58
|
+
...user_1.userFields,
|
|
59
|
+
...scheduledTask_1.scheduledTaskOperations,
|
|
60
|
+
...scheduledTask_1.scheduledTaskFields,
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
exports.Bgos = Bgos;
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assistantFields = exports.assistantOperations = void 0;
|
|
4
|
+
exports.assistantOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['assistant'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Create Assistant',
|
|
18
|
+
value: 'createAssistant',
|
|
19
|
+
description: 'Create a new assistant',
|
|
20
|
+
routing: {
|
|
21
|
+
request: {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: '/api/v1/assistants',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
action: 'Create an assistant',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Get Assistant',
|
|
30
|
+
value: 'getAssistant',
|
|
31
|
+
description: 'Get an assistant by ID',
|
|
32
|
+
routing: {
|
|
33
|
+
request: {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
url: '=/api/v1/assistants/{{$parameter.assistantId}}/details',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
action: 'Get an assistant',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Update Assistant',
|
|
42
|
+
value: 'updateAssistant',
|
|
43
|
+
description: 'Update an assistant',
|
|
44
|
+
routing: {
|
|
45
|
+
request: {
|
|
46
|
+
method: 'PATCH',
|
|
47
|
+
url: '=/api/v1/assistants/{{$parameter.assistantId}}',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
action: 'Update an assistant',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Delete Assistant',
|
|
54
|
+
value: 'deleteAssistant',
|
|
55
|
+
description: 'Delete an assistant',
|
|
56
|
+
routing: {
|
|
57
|
+
request: {
|
|
58
|
+
method: 'DELETE',
|
|
59
|
+
url: '=/api/v1/assistants/{{$parameter.assistantId}}',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
action: 'Delete an assistant',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Reorder Assistants',
|
|
66
|
+
value: 'reorderAssistants',
|
|
67
|
+
description: 'Bulk reorder assistants',
|
|
68
|
+
routing: {
|
|
69
|
+
request: {
|
|
70
|
+
method: 'PATCH',
|
|
71
|
+
url: '/api/v1/assistants/reorder',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
action: 'Reorder assistants',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Get Assistants With Chats',
|
|
78
|
+
value: 'getWithChats',
|
|
79
|
+
description: 'Get all assistants with their chats for a user',
|
|
80
|
+
routing: {
|
|
81
|
+
request: {
|
|
82
|
+
method: 'GET',
|
|
83
|
+
url: '=/api/v1/assistants/with-chats/{{$parameter.userId}}',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
action: 'Get assistants with chats',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
default: 'createAssistant',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
exports.assistantFields = [
|
|
93
|
+
// --- assistantId (shared) ---
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Assistant ID',
|
|
96
|
+
name: 'assistantId',
|
|
97
|
+
type: 'number',
|
|
98
|
+
required: true,
|
|
99
|
+
default: 0,
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
resource: ['assistant'],
|
|
103
|
+
operation: ['getAssistant', 'updateAssistant', 'deleteAssistant'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
description: 'The assistant ID',
|
|
107
|
+
},
|
|
108
|
+
// --- userId (shared) ---
|
|
109
|
+
{
|
|
110
|
+
displayName: 'User ID',
|
|
111
|
+
name: 'userId',
|
|
112
|
+
type: 'string',
|
|
113
|
+
required: true,
|
|
114
|
+
default: '',
|
|
115
|
+
displayOptions: {
|
|
116
|
+
show: {
|
|
117
|
+
resource: ['assistant'],
|
|
118
|
+
operation: ['createAssistant', 'getAssistant', 'updateAssistant', 'reorderAssistants', 'getWithChats'],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
description: 'The user ID',
|
|
122
|
+
},
|
|
123
|
+
// --- createAssistant fields ---
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Name',
|
|
126
|
+
name: 'name',
|
|
127
|
+
type: 'string',
|
|
128
|
+
required: true,
|
|
129
|
+
default: '',
|
|
130
|
+
displayOptions: {
|
|
131
|
+
show: {
|
|
132
|
+
resource: ['assistant'],
|
|
133
|
+
operation: ['createAssistant'],
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
routing: {
|
|
137
|
+
send: {
|
|
138
|
+
type: 'body',
|
|
139
|
+
property: 'name',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
description: 'The assistant name',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
// Hidden - sends userId to body for createAssistant
|
|
146
|
+
displayName: 'Create Assistant User ID Body',
|
|
147
|
+
name: 'createAssistantUserIdBody',
|
|
148
|
+
type: 'hidden',
|
|
149
|
+
default: '={{$parameter.userId}}',
|
|
150
|
+
displayOptions: {
|
|
151
|
+
show: {
|
|
152
|
+
resource: ['assistant'],
|
|
153
|
+
operation: ['createAssistant'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
routing: {
|
|
157
|
+
send: {
|
|
158
|
+
type: 'body',
|
|
159
|
+
property: 'userId',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
displayName: 'Additional Fields',
|
|
165
|
+
name: 'additionalFields',
|
|
166
|
+
type: 'collection',
|
|
167
|
+
placeholder: 'Add Field',
|
|
168
|
+
default: {},
|
|
169
|
+
displayOptions: {
|
|
170
|
+
show: {
|
|
171
|
+
resource: ['assistant'],
|
|
172
|
+
operation: ['createAssistant'],
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
options: [
|
|
176
|
+
{
|
|
177
|
+
displayName: 'Avatar URL',
|
|
178
|
+
name: 'avatarUrl',
|
|
179
|
+
type: 'string',
|
|
180
|
+
default: '',
|
|
181
|
+
routing: { send: { type: 'body', property: 'avatarUrl' } },
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Webhook URL',
|
|
185
|
+
name: 'webhookUrl',
|
|
186
|
+
type: 'string',
|
|
187
|
+
default: '',
|
|
188
|
+
routing: { send: { type: 'body', property: 'webhookUrl' } },
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
displayName: 'Subtitle',
|
|
192
|
+
name: 'subtitle',
|
|
193
|
+
type: 'string',
|
|
194
|
+
default: '',
|
|
195
|
+
routing: { send: { type: 'body', property: 'subtitle' } },
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
displayName: 'Code',
|
|
199
|
+
name: 'code',
|
|
200
|
+
type: 'string',
|
|
201
|
+
default: '',
|
|
202
|
+
routing: { send: { type: 'body', property: 'code' } },
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
displayName: 'S2S Token',
|
|
206
|
+
name: 's2sToken',
|
|
207
|
+
type: 'string',
|
|
208
|
+
default: '',
|
|
209
|
+
routing: { send: { type: 'body', property: 's2sToken' } },
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
// --- updateAssistant fields ---
|
|
214
|
+
{
|
|
215
|
+
displayName: 'Name',
|
|
216
|
+
name: 'name',
|
|
217
|
+
type: 'string',
|
|
218
|
+
required: true,
|
|
219
|
+
default: '',
|
|
220
|
+
displayOptions: {
|
|
221
|
+
show: {
|
|
222
|
+
resource: ['assistant'],
|
|
223
|
+
operation: ['updateAssistant'],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
routing: {
|
|
227
|
+
send: {
|
|
228
|
+
type: 'body',
|
|
229
|
+
property: 'name',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
description: 'The assistant name',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
// Hidden - sends userId to body for updateAssistant
|
|
236
|
+
displayName: 'Update Assistant User ID Body',
|
|
237
|
+
name: 'updateAssistantUserIdBody',
|
|
238
|
+
type: 'hidden',
|
|
239
|
+
default: '={{$parameter.userId}}',
|
|
240
|
+
displayOptions: {
|
|
241
|
+
show: {
|
|
242
|
+
resource: ['assistant'],
|
|
243
|
+
operation: ['updateAssistant'],
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
routing: {
|
|
247
|
+
send: {
|
|
248
|
+
type: 'body',
|
|
249
|
+
property: 'userId',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
displayName: 'Update Fields',
|
|
255
|
+
name: 'updateFields',
|
|
256
|
+
type: 'collection',
|
|
257
|
+
placeholder: 'Add Field',
|
|
258
|
+
default: {},
|
|
259
|
+
displayOptions: {
|
|
260
|
+
show: {
|
|
261
|
+
resource: ['assistant'],
|
|
262
|
+
operation: ['updateAssistant'],
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
options: [
|
|
266
|
+
{
|
|
267
|
+
displayName: 'Avatar URL',
|
|
268
|
+
name: 'avatarUrl',
|
|
269
|
+
type: 'string',
|
|
270
|
+
default: '',
|
|
271
|
+
routing: { send: { type: 'body', property: 'avatarUrl' } },
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
displayName: 'Webhook URL',
|
|
275
|
+
name: 'webhookUrl',
|
|
276
|
+
type: 'string',
|
|
277
|
+
default: '',
|
|
278
|
+
routing: { send: { type: 'body', property: 'webhookUrl' } },
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
displayName: 'Subtitle',
|
|
282
|
+
name: 'subtitle',
|
|
283
|
+
type: 'string',
|
|
284
|
+
default: '',
|
|
285
|
+
routing: { send: { type: 'body', property: 'subtitle' } },
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
displayName: 'Code',
|
|
289
|
+
name: 'code',
|
|
290
|
+
type: 'string',
|
|
291
|
+
default: '',
|
|
292
|
+
routing: { send: { type: 'body', property: 'code' } },
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
displayName: 'S2S Token',
|
|
296
|
+
name: 's2sToken',
|
|
297
|
+
type: 'string',
|
|
298
|
+
default: '',
|
|
299
|
+
routing: { send: { type: 'body', property: 's2sToken' } },
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
},
|
|
303
|
+
// --- getAssistant query param ---
|
|
304
|
+
{
|
|
305
|
+
displayName: 'Get Assistant User ID Query',
|
|
306
|
+
name: 'getAssistantUserIdQuery',
|
|
307
|
+
type: 'hidden',
|
|
308
|
+
default: '={{$parameter.userId}}',
|
|
309
|
+
displayOptions: {
|
|
310
|
+
show: {
|
|
311
|
+
resource: ['assistant'],
|
|
312
|
+
operation: ['getAssistant'],
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
routing: {
|
|
316
|
+
send: {
|
|
317
|
+
type: 'query',
|
|
318
|
+
property: 'userId',
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
// --- reorderAssistants fields ---
|
|
323
|
+
{
|
|
324
|
+
// Hidden - sends userId to body for reorder
|
|
325
|
+
displayName: 'Reorder User ID Body',
|
|
326
|
+
name: 'reorderUserIdBody',
|
|
327
|
+
type: 'hidden',
|
|
328
|
+
default: '={{$parameter.userId}}',
|
|
329
|
+
displayOptions: {
|
|
330
|
+
show: {
|
|
331
|
+
resource: ['assistant'],
|
|
332
|
+
operation: ['reorderAssistants'],
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
routing: {
|
|
336
|
+
send: {
|
|
337
|
+
type: 'body',
|
|
338
|
+
property: 'userId',
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
displayName: 'Assistant Orders JSON',
|
|
344
|
+
name: 'assistantOrders',
|
|
345
|
+
type: 'json',
|
|
346
|
+
required: true,
|
|
347
|
+
default: '[]',
|
|
348
|
+
displayOptions: {
|
|
349
|
+
show: {
|
|
350
|
+
resource: ['assistant'],
|
|
351
|
+
operation: ['reorderAssistants'],
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
routing: {
|
|
355
|
+
send: {
|
|
356
|
+
type: 'body',
|
|
357
|
+
property: 'assistantOrders',
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
description: 'JSON array of { id, displayOrder } objects',
|
|
361
|
+
},
|
|
362
|
+
];
|