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,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scheduledTaskFields = exports.scheduledTaskOperations = void 0;
|
|
4
|
+
exports.scheduledTaskOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['scheduledTask'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get Task',
|
|
18
|
+
value: 'getTask',
|
|
19
|
+
description: 'Get a scheduled task by ID',
|
|
20
|
+
routing: {
|
|
21
|
+
request: {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
url: '=/api/v1/scheduled-tasks/{{$parameter.taskId}}',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
action: 'Get a scheduled task',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Get User Tasks',
|
|
30
|
+
value: 'getUserTasks',
|
|
31
|
+
description: 'Get all scheduled tasks for a user',
|
|
32
|
+
routing: {
|
|
33
|
+
request: {
|
|
34
|
+
method: 'GET',
|
|
35
|
+
url: '=/api/v1/scheduled-tasks/user/{{$parameter.userId}}',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
action: 'Get user scheduled tasks',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Delete Task',
|
|
42
|
+
value: 'deleteTask',
|
|
43
|
+
description: 'Delete a scheduled task',
|
|
44
|
+
routing: {
|
|
45
|
+
request: {
|
|
46
|
+
method: 'DELETE',
|
|
47
|
+
url: '=/api/v1/scheduled-tasks/{{$parameter.taskId}}',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
action: 'Delete a scheduled task',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
default: 'getTask',
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
exports.scheduledTaskFields = [
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Task ID',
|
|
59
|
+
name: 'taskId',
|
|
60
|
+
type: 'number',
|
|
61
|
+
required: true,
|
|
62
|
+
default: 0,
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: ['scheduledTask'],
|
|
66
|
+
operation: ['getTask', 'deleteTask'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
description: 'The scheduled task ID',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
displayName: 'User ID',
|
|
73
|
+
name: 'userId',
|
|
74
|
+
type: 'string',
|
|
75
|
+
required: true,
|
|
76
|
+
default: '',
|
|
77
|
+
displayOptions: {
|
|
78
|
+
show: {
|
|
79
|
+
resource: ['scheduledTask'],
|
|
80
|
+
operation: ['getUserTasks'],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
description: 'The user ID',
|
|
84
|
+
},
|
|
85
|
+
];
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userFields = exports.userOperations = void 0;
|
|
4
|
+
exports.userOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['user'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get or Create',
|
|
18
|
+
value: 'getOrCreate',
|
|
19
|
+
description: 'Get an existing user or create a new one',
|
|
20
|
+
routing: {
|
|
21
|
+
request: {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: '/api/v1/users',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
action: 'Get or create a user',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Update User',
|
|
30
|
+
value: 'updateUser',
|
|
31
|
+
description: 'Update a user',
|
|
32
|
+
routing: {
|
|
33
|
+
request: {
|
|
34
|
+
method: 'PATCH',
|
|
35
|
+
url: '=/api/v1/users/{{$parameter.userId}}',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
action: 'Update a user',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
default: 'getOrCreate',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
exports.userFields = [
|
|
45
|
+
// --- getOrCreate fields ---
|
|
46
|
+
{
|
|
47
|
+
displayName: 'User ID',
|
|
48
|
+
name: 'id',
|
|
49
|
+
type: 'string',
|
|
50
|
+
required: true,
|
|
51
|
+
default: '',
|
|
52
|
+
displayOptions: {
|
|
53
|
+
show: {
|
|
54
|
+
resource: ['user'],
|
|
55
|
+
operation: ['getOrCreate'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
routing: {
|
|
59
|
+
send: {
|
|
60
|
+
type: 'body',
|
|
61
|
+
property: 'id',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
description: 'The user identifier',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Email',
|
|
68
|
+
name: 'email',
|
|
69
|
+
type: 'string',
|
|
70
|
+
placeholder: 'name@email.com',
|
|
71
|
+
required: true,
|
|
72
|
+
default: '',
|
|
73
|
+
displayOptions: {
|
|
74
|
+
show: {
|
|
75
|
+
resource: ['user'],
|
|
76
|
+
operation: ['getOrCreate'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
routing: {
|
|
80
|
+
send: {
|
|
81
|
+
type: 'body',
|
|
82
|
+
property: 'email',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
description: 'The user email',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Name',
|
|
89
|
+
name: 'name',
|
|
90
|
+
type: 'string',
|
|
91
|
+
required: true,
|
|
92
|
+
default: '',
|
|
93
|
+
displayOptions: {
|
|
94
|
+
show: {
|
|
95
|
+
resource: ['user'],
|
|
96
|
+
operation: ['getOrCreate'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
routing: {
|
|
100
|
+
send: {
|
|
101
|
+
type: 'body',
|
|
102
|
+
property: 'name',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
description: 'The user name',
|
|
106
|
+
},
|
|
107
|
+
// --- updateUser fields ---
|
|
108
|
+
{
|
|
109
|
+
displayName: 'User ID',
|
|
110
|
+
name: 'userId',
|
|
111
|
+
type: 'string',
|
|
112
|
+
required: true,
|
|
113
|
+
default: '',
|
|
114
|
+
displayOptions: {
|
|
115
|
+
show: {
|
|
116
|
+
resource: ['user'],
|
|
117
|
+
operation: ['updateUser'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
description: 'The user ID to update',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
displayName: 'Update Fields',
|
|
124
|
+
name: 'updateFields',
|
|
125
|
+
type: 'collection',
|
|
126
|
+
placeholder: 'Add Field',
|
|
127
|
+
default: {},
|
|
128
|
+
displayOptions: {
|
|
129
|
+
show: {
|
|
130
|
+
resource: ['user'],
|
|
131
|
+
operation: ['updateUser'],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
options: [
|
|
135
|
+
{
|
|
136
|
+
displayName: 'Name',
|
|
137
|
+
name: 'name',
|
|
138
|
+
type: 'string',
|
|
139
|
+
default: '',
|
|
140
|
+
routing: { send: { type: 'body', property: 'name' } },
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Email',
|
|
144
|
+
name: 'email',
|
|
145
|
+
type: 'string',
|
|
146
|
+
default: '',
|
|
147
|
+
routing: { send: { type: 'body', property: 'email' } },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Avatar URL',
|
|
151
|
+
name: 'avatarUrl',
|
|
152
|
+
type: 'string',
|
|
153
|
+
default: '',
|
|
154
|
+
routing: { send: { type: 'body', property: 'avatarUrl' } },
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IWebhookFunctions, IHookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class BgosTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
5
|
+
webhookMethods: {
|
|
6
|
+
default: {
|
|
7
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
8
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
9
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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.BgosTrigger = void 0;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
|
+
const stubs_1 = require("./stubs");
|
|
10
|
+
class BgosTrigger {
|
|
11
|
+
description = {
|
|
12
|
+
displayName: 'BGOS Trigger',
|
|
13
|
+
name: 'bgosTrigger',
|
|
14
|
+
icon: 'file:../../icons/bgos.png',
|
|
15
|
+
group: ['trigger'],
|
|
16
|
+
version: 1,
|
|
17
|
+
subtitle: '={{$parameter["updates"]}}',
|
|
18
|
+
description: 'Starts the workflow on a BGOS Assistant update',
|
|
19
|
+
defaults: { name: 'BGOS Trigger' },
|
|
20
|
+
inputs: [],
|
|
21
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
22
|
+
credentials: [{ name: 'bgosApi', required: false }],
|
|
23
|
+
webhooks: [
|
|
24
|
+
{ name: 'default', httpMethod: 'POST', responseMode: 'onReceived', path: 'webhook' },
|
|
25
|
+
],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Events',
|
|
29
|
+
name: 'updates',
|
|
30
|
+
type: 'multiOptions',
|
|
31
|
+
options: [
|
|
32
|
+
{ name: '*', value: '*', description: 'All events' },
|
|
33
|
+
{ name: 'Message', value: 'message', description: 'Text message event' },
|
|
34
|
+
{ name: 'Edited Message', value: 'edited_message', description: 'Edited text message event' },
|
|
35
|
+
{ name: 'Voice Message', value: 'voice_message', description: 'Voice message event' },
|
|
36
|
+
{ name: 'New Chat', value: 'new_chat', description: 'New chat created' },
|
|
37
|
+
{ name: 'Chat Renamed', value: 'chat_renamed', description: 'Chat title was changed' },
|
|
38
|
+
{ name: 'New Assistant', value: 'new_assistant', description: 'Assistant was created' },
|
|
39
|
+
{ name: 'Voice Started', value: 'voice_started', description: 'Voice session started' },
|
|
40
|
+
{ name: 'Voice Ended', value: 'voice_ended', description: 'Voice session ended' },
|
|
41
|
+
{ name: 'Reply Message', value: 'reply_message', description: 'Reply to an existing message' },
|
|
42
|
+
{ name: 'Message Deleted', value: 'message_deleted', description: 'Message was deleted' },
|
|
43
|
+
{ name: 'Chat Deleted', value: 'chat_deleted', description: 'Chat was deleted' },
|
|
44
|
+
{ name: 'Assistant Updated', value: 'assistant_updated', description: 'Assistant settings were updated' },
|
|
45
|
+
{ name: 'Assistant Deleted', value: 'assistant_deleted', description: 'Assistant was deleted' },
|
|
46
|
+
{ name: 'User Created', value: 'user_created', description: 'User was created' },
|
|
47
|
+
{ name: 'User Updated', value: 'user_updated', description: 'User profile was updated' },
|
|
48
|
+
{ name: 'Button Clicked', value: 'button_clicked', description: 'Interactive button was clicked' },
|
|
49
|
+
],
|
|
50
|
+
default: ['message'],
|
|
51
|
+
required: true,
|
|
52
|
+
description: 'Which events to listen for',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
async webhook() {
|
|
57
|
+
const rawBody = this.getBodyData();
|
|
58
|
+
const updates = this.getNodeParameter('updates', 0);
|
|
59
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
60
|
+
const now = Date.now();
|
|
61
|
+
const windowMs = 1000;
|
|
62
|
+
const maxEvents = 10;
|
|
63
|
+
const history = Array.isArray(staticData.rateHistory) ? staticData.rateHistory : [];
|
|
64
|
+
const recent = history.filter((ts) => now - ts < windowMs);
|
|
65
|
+
if (recent.length >= maxEvents)
|
|
66
|
+
return { workflowData: [] };
|
|
67
|
+
recent.push(now);
|
|
68
|
+
staticData.rateHistory = recent;
|
|
69
|
+
let eventData;
|
|
70
|
+
if (rawBody && rawBody.event_type) {
|
|
71
|
+
eventData = rawBody;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
eventData = (0, stubs_1.getMockEventData)('message');
|
|
75
|
+
}
|
|
76
|
+
const eventType = String(eventData.event_type || '');
|
|
77
|
+
if (!updates.includes('*') && !updates.includes(eventType))
|
|
78
|
+
return { workflowData: [] };
|
|
79
|
+
return {
|
|
80
|
+
workflowData: [this.helpers.returnJsonArray([eventData])],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
webhookMethods = {
|
|
84
|
+
default: {
|
|
85
|
+
async checkExists() {
|
|
86
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
87
|
+
return Boolean(staticData.webhookSubscriptionId);
|
|
88
|
+
},
|
|
89
|
+
async create() {
|
|
90
|
+
const credentials = (await this.getCredentials('bgosApi'));
|
|
91
|
+
const baseUrl = credentials?.baseUrl ?? credentials?.apiUrl;
|
|
92
|
+
const apiKey = credentials?.apiKey;
|
|
93
|
+
if (!baseUrl || !apiKey)
|
|
94
|
+
return true;
|
|
95
|
+
const url = `${String(baseUrl).replace(/\/$/, '')}/api/v1/webhooks`;
|
|
96
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
97
|
+
const updates = this.getNodeParameter('updates', 0);
|
|
98
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
99
|
+
method: 'POST',
|
|
100
|
+
headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey },
|
|
101
|
+
body: JSON.stringify({ webhookUrl, eventTypes: updates?.length ? updates : ['*'] }),
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw new Error(`Failed to register BGOS webhook: ${response.status} ${response.statusText} - ${await response.text()}`);
|
|
105
|
+
}
|
|
106
|
+
const data = (await response.json());
|
|
107
|
+
if (data?.id != null) {
|
|
108
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
109
|
+
staticData.webhookSubscriptionId = String(data.id);
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
},
|
|
113
|
+
async delete() {
|
|
114
|
+
const staticData = this.getWorkflowStaticData('node');
|
|
115
|
+
const subscriptionId = staticData.webhookSubscriptionId;
|
|
116
|
+
const credentials = (await this.getCredentials('bgosApi'));
|
|
117
|
+
const baseUrl = credentials?.baseUrl ?? credentials?.apiUrl;
|
|
118
|
+
const apiKey = credentials?.apiKey;
|
|
119
|
+
if (!subscriptionId || !baseUrl || !apiKey)
|
|
120
|
+
return true;
|
|
121
|
+
const url = `${String(baseUrl).replace(/\/$/, '')}/api/v1/webhooks/${subscriptionId}`;
|
|
122
|
+
try {
|
|
123
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
124
|
+
method: 'DELETE',
|
|
125
|
+
headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey },
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
// eslint-disable-next-line no-console
|
|
129
|
+
console.error(`Failed to delete BGOS webhook ${subscriptionId}: ${response.status} ${response.statusText}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
// eslint-disable-next-line no-console
|
|
134
|
+
console.error(`Error deleting BGOS webhook ${subscriptionId}:`, error);
|
|
135
|
+
}
|
|
136
|
+
delete staticData.webhookSubscriptionId;
|
|
137
|
+
return true;
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
exports.BgosTrigger = BgosTrigger;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mock event data for testing BGOS Trigger node.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getMockEventData = getMockEventData;
|
|
7
|
+
function getMockEventData(eventType) {
|
|
8
|
+
const mockEvents = {
|
|
9
|
+
message: {
|
|
10
|
+
event_type: 'message',
|
|
11
|
+
message_id: 'mock_msg_123',
|
|
12
|
+
chat_id: 'mock_chat_456',
|
|
13
|
+
user_id: 'mock_user_789',
|
|
14
|
+
text: 'This is a mock message for testing',
|
|
15
|
+
timestamp: new Date().toISOString(),
|
|
16
|
+
},
|
|
17
|
+
edited_message: {
|
|
18
|
+
event_type: 'edited_message',
|
|
19
|
+
message_id: 'mock_msg_123',
|
|
20
|
+
chat_id: 'mock_chat_456',
|
|
21
|
+
user_id: 'mock_user_789',
|
|
22
|
+
text: 'This is an edited mock message',
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
},
|
|
25
|
+
voice_message: {
|
|
26
|
+
event_type: 'voice_message',
|
|
27
|
+
message_id: 'mock_voice_123',
|
|
28
|
+
chat_id: 'mock_chat_456',
|
|
29
|
+
user_id: 'mock_user_789',
|
|
30
|
+
voice_url: 'https://example.com/voice.mp3',
|
|
31
|
+
duration: 30,
|
|
32
|
+
timestamp: new Date().toISOString(),
|
|
33
|
+
},
|
|
34
|
+
new_chat: {
|
|
35
|
+
event_type: 'new_chat',
|
|
36
|
+
chat_id: 'mock_chat_456',
|
|
37
|
+
user_id: 'mock_user_789',
|
|
38
|
+
chat_name: 'Mock Chat',
|
|
39
|
+
timestamp: new Date().toISOString(),
|
|
40
|
+
},
|
|
41
|
+
chat_renamed: {
|
|
42
|
+
event_type: 'chat_renamed',
|
|
43
|
+
chat_id: 'mock_chat_456',
|
|
44
|
+
old_name: 'Old Chat Name',
|
|
45
|
+
new_name: 'New Chat Name',
|
|
46
|
+
timestamp: new Date().toISOString(),
|
|
47
|
+
},
|
|
48
|
+
new_assistant: {
|
|
49
|
+
event_type: 'new_assistant',
|
|
50
|
+
assistant_id: 'mock_assistant_123',
|
|
51
|
+
chat_id: 'mock_chat_456',
|
|
52
|
+
assistant_name: 'Mock Assistant',
|
|
53
|
+
timestamp: new Date().toISOString(),
|
|
54
|
+
},
|
|
55
|
+
voice_started: {
|
|
56
|
+
event_type: 'voice_started',
|
|
57
|
+
chat_id: 'mock_chat_456',
|
|
58
|
+
user_id: 'mock_user_789',
|
|
59
|
+
timestamp: new Date().toISOString(),
|
|
60
|
+
},
|
|
61
|
+
voice_ended: {
|
|
62
|
+
event_type: 'voice_ended',
|
|
63
|
+
chat_id: 'mock_chat_456',
|
|
64
|
+
user_id: 'mock_user_789',
|
|
65
|
+
duration: 120,
|
|
66
|
+
timestamp: new Date().toISOString(),
|
|
67
|
+
},
|
|
68
|
+
button_clicked: {
|
|
69
|
+
event_type: 'button_clicked',
|
|
70
|
+
button_id: 'mock_button_123',
|
|
71
|
+
chat_id: 'mock_chat_456',
|
|
72
|
+
user_id: 'mock_user_789',
|
|
73
|
+
timestamp: new Date().toISOString(),
|
|
74
|
+
},
|
|
75
|
+
reply_message: {
|
|
76
|
+
event_type: 'reply_message',
|
|
77
|
+
message_id: 'mock_msg_123',
|
|
78
|
+
reply_to_message_id: 'mock_msg_456',
|
|
79
|
+
chat_id: 'mock_chat_456',
|
|
80
|
+
user_id: 'mock_user_789',
|
|
81
|
+
text: 'This is a reply message',
|
|
82
|
+
timestamp: new Date().toISOString(),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return mockEvents[eventType] ?? mockEvents.message;
|
|
86
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-bgos",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "n8n community nodes for BGOS (Brand Growth OS) - AI assistant chat platform",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"bgos",
|
|
9
|
+
"chat",
|
|
10
|
+
"assistant",
|
|
11
|
+
"ai"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"homepage": "https://github.com/BrandGrowthOS/bgos-n8n-nodes",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "BGOS Team",
|
|
17
|
+
"url": "https://github.com/BrandGrowthOS"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/BrandGrowthOS/bgos-n8n-nodes.git"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18.10",
|
|
25
|
+
"pnpm": ">=9.1"
|
|
26
|
+
},
|
|
27
|
+
"main": "dist/nodes/Bgos/Bgos.node.js",
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE.md"
|
|
32
|
+
],
|
|
33
|
+
"n8n": {
|
|
34
|
+
"n8nNodesApiVersion": 1,
|
|
35
|
+
"credentials": [
|
|
36
|
+
"dist/credentials/BgosApi.credentials.js"
|
|
37
|
+
],
|
|
38
|
+
"nodes": [
|
|
39
|
+
"dist/nodes/Bgos/Bgos.node.js",
|
|
40
|
+
"dist/nodes/BgosTrigger/BgosTrigger.node.js",
|
|
41
|
+
"dist/nodes/BGOSAction/BGOSAction.node.js"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"bottleneck": "^2.19.5",
|
|
46
|
+
"form-data": "^4.0.0",
|
|
47
|
+
"http-status-codes": "^2.3.0",
|
|
48
|
+
"node-fetch": "^3.3.2"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^20.0.0",
|
|
52
|
+
"@typescript-eslint/parser": "~7.18.0",
|
|
53
|
+
"eslint": "~8.56.0",
|
|
54
|
+
"eslint-plugin-n8n-nodes-base": "~1.16.2",
|
|
55
|
+
"gulp": "~5.0.0",
|
|
56
|
+
"n8n-workflow": "*",
|
|
57
|
+
"prettier": "~3.3.3",
|
|
58
|
+
"typescript": "~5.6.3"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"n8n-workflow": "*"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"preinstall": "npx only-allow pnpm",
|
|
65
|
+
"build": "tsc && gulp build:icons",
|
|
66
|
+
"dev": "tsc --watch",
|
|
67
|
+
"format": "prettier nodes credentials --write",
|
|
68
|
+
"lint": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.cjs .",
|
|
69
|
+
"lintfix": "ESLINT_USE_FLAT_CONFIG=true eslint -c eslint.config.cjs . --fix"
|
|
70
|
+
}
|
|
71
|
+
}
|