n8n-nodes-max 0.1.2 → 0.1.4
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/README.md +49 -463
- package/dist/nodes/Max/GenericFunctions.d.ts +1 -0
- package/dist/nodes/Max/GenericFunctions.js +34 -6
- package/dist/nodes/Max/GenericFunctions.js.map +1 -1
- package/dist/nodes/Max/Max.node.js +198 -188
- package/dist/nodes/Max/Max.node.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,492 +1,78 @@
|
|
|
1
1
|
# n8n-nodes-max
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Нода для интеграции мессенджера Max с платформой автоматизации n8n.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Установка
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[Installation](#installation)
|
|
10
|
-
[Operations](#operations)
|
|
11
|
-
[Credentials](#credentials)
|
|
12
|
-
[Compatibility](#compatibility)
|
|
13
|
-
[Usage](#usage)
|
|
14
|
-
[Example Workflows](#example-workflows)
|
|
15
|
-
[Troubleshooting](#troubleshooting)
|
|
16
|
-
[Resources](#resources)
|
|
17
|
-
[Version History](#version-history)
|
|
18
|
-
|
|
19
|
-
## Installation
|
|
20
|
-
|
|
21
|
-
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
22
|
-
|
|
23
|
-
Install the package using npm:
|
|
7
|
+
### Для self-hosted n8n
|
|
24
8
|
|
|
9
|
+
1. Установите пакет через npm в директории n8n:
|
|
25
10
|
```bash
|
|
26
11
|
npm install n8n-nodes-max
|
|
27
12
|
```
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
## Operations
|
|
32
|
-
|
|
33
|
-
The Max messenger node supports the following operations:
|
|
34
|
-
|
|
35
|
-
### Message Operations
|
|
36
|
-
- **Send Message**: Send text messages to users or chats with formatting support (HTML/Markdown)
|
|
37
|
-
- **Edit Message**: Modify existing message content
|
|
38
|
-
- **Delete Message**: Remove messages from chats
|
|
39
|
-
- **Answer Callback Query**: Respond to inline keyboard button interactions
|
|
40
|
-
|
|
41
|
-
### Chat Operations
|
|
42
|
-
- **Get Chat Info**: Retrieve chat metadata and participant information
|
|
43
|
-
- **Leave Chat**: Remove the bot from group chats
|
|
44
|
-
|
|
45
|
-
### Advanced Features
|
|
46
|
-
- **File Attachments**: Send images, videos, audio files, and documents
|
|
47
|
-
- **Inline Keyboards**: Create interactive button layouts with callbacks, links, and special actions
|
|
48
|
-
- **Text Formatting**: Support for HTML and Markdown formatting
|
|
49
|
-
- **Error Handling**: Comprehensive error handling with retry mechanisms
|
|
50
|
-
|
|
51
|
-
### Trigger Node
|
|
52
|
-
The Max Trigger node allows you to receive real-time events from Max messenger:
|
|
53
|
-
- **Message Events**: New messages, edited messages, deleted messages
|
|
54
|
-
- **Bot Events**: Bot started, bot added/removed from chats
|
|
55
|
-
- **User Events**: Users joining/leaving chats
|
|
56
|
-
- **Callback Events**: Button interactions and responses
|
|
57
|
-
|
|
58
|
-
## Credentials
|
|
59
|
-
|
|
60
|
-
To use the Max messenger node, you need to create a bot and obtain an access token:
|
|
61
|
-
|
|
62
|
-
### Prerequisites
|
|
63
|
-
1. Have a Max messenger account
|
|
64
|
-
2. Access to @MasterBot in Max messenger
|
|
65
|
-
|
|
66
|
-
### Setting up Bot Credentials
|
|
67
|
-
|
|
68
|
-
1. **Create a Bot**:
|
|
69
|
-
- Open Max messenger and find @MasterBot
|
|
70
|
-
- Send `/newbot` command to @MasterBot
|
|
71
|
-
- Follow the instructions to create your bot
|
|
72
|
-
- Choose a name and username for your bot
|
|
73
|
-
- Save the access token provided by @MasterBot
|
|
74
|
-
|
|
75
|
-
2. **Configure Credentials in n8n**:
|
|
76
|
-
- In your n8n workflow, add a Max node
|
|
77
|
-
- Click "Create New Credentials"
|
|
78
|
-
- Enter your bot's access token in the "Access Token" field
|
|
79
|
-
- (Optional) Modify the "Base URL" if using a custom Max API endpoint
|
|
80
|
-
- Click "Save" to store your credentials
|
|
81
|
-
|
|
82
|
-
3. **Test Your Credentials**:
|
|
83
|
-
- n8n will automatically test your credentials by making a request to the Max API
|
|
84
|
-
- If successful, you'll see a green checkmark
|
|
85
|
-
- If there's an error, verify your token is correct and your bot is active
|
|
14
|
+
2. Перезапустите n8n для загрузки новой ноды
|
|
86
15
|
|
|
87
|
-
###
|
|
88
|
-
- Keep your bot token secure and never share it publicly
|
|
89
|
-
- Use environment variables for token storage in production environments
|
|
90
|
-
- Regularly rotate your bot tokens for enhanced security
|
|
16
|
+
### Для n8n Cloud
|
|
91
17
|
|
|
92
|
-
|
|
18
|
+
1. Откройте настройки вашего workspace
|
|
19
|
+
2. Перейдите в раздел "Community nodes"
|
|
20
|
+
3. Нажмите "Install a community node"
|
|
21
|
+
4. Введите `n8n-nodes-max` и нажмите "Install"
|
|
93
22
|
|
|
94
|
-
|
|
95
|
-
- **Node.js version**: 20.15 or higher
|
|
96
|
-
- **Tested with n8n versions**: 1.0.0 - 1.70.0
|
|
97
|
-
|
|
98
|
-
### Known Compatibility Issues
|
|
99
|
-
- None currently identified
|
|
100
|
-
|
|
101
|
-
## Usage
|
|
102
|
-
|
|
103
|
-
### Basic Message Sending
|
|
104
|
-
|
|
105
|
-
1. **Add Max Node**: Drag the Max node into your workflow
|
|
106
|
-
2. **Configure Credentials**: Set up your bot credentials as described above
|
|
107
|
-
3. **Select Operation**: Choose "Send Message" from the Message resource
|
|
108
|
-
4. **Set Recipients**:
|
|
109
|
-
- For direct messages: Enter the user ID in "User ID" field
|
|
110
|
-
- For group chats: Enter the chat ID in "Chat ID" field
|
|
111
|
-
5. **Compose Message**: Enter your message text with optional formatting
|
|
112
|
-
6. **Execute**: Run the workflow to send your message
|
|
113
|
-
|
|
114
|
-
### Working with Attachments
|
|
115
|
-
|
|
116
|
-
To send files with your messages:
|
|
117
|
-
|
|
118
|
-
1. **Enable Attachments**: Toggle the "Add Attachments" option
|
|
119
|
-
2. **Choose Attachment Type**: Select from image, video, audio, file, or sticker
|
|
120
|
-
3. **Provide File Source**:
|
|
121
|
-
- **Binary Data**: Use data from previous nodes (recommended)
|
|
122
|
-
- **File Path**: Specify a local file path
|
|
123
|
-
- **URL**: Provide a direct link to the file
|
|
124
|
-
4. **Configure Options**: Set additional parameters like captions or thumbnails
|
|
125
|
-
|
|
126
|
-
### Creating Interactive Keyboards
|
|
127
|
-
|
|
128
|
-
To add interactive buttons to your messages:
|
|
129
|
-
|
|
130
|
-
1. **Enable Keyboard**: Toggle the "Add Keyboard" option
|
|
131
|
-
2. **Choose Keyboard Type**: Select "Inline Keyboard"
|
|
132
|
-
3. **Add Buttons**: Configure button rows with:
|
|
133
|
-
- **Text**: Button label visible to users
|
|
134
|
-
- **Type**: Choose from callback, link, contact request, or location request
|
|
135
|
-
- **Payload/URL**: Set the action data for the button
|
|
136
|
-
4. **Layout**: Organize buttons in rows (max 8 buttons per row)
|
|
137
|
-
|
|
138
|
-
### Setting up Webhooks (Trigger Node)
|
|
139
|
-
|
|
140
|
-
1. **Add Max Trigger Node**: Drag the Max Trigger node into your workflow
|
|
141
|
-
2. **Configure Credentials**: Use the same bot credentials
|
|
142
|
-
3. **Set Webhook URL**: Copy the webhook URL provided by n8n
|
|
143
|
-
4. **Register Webhook**: The node will automatically register the webhook with Max API
|
|
144
|
-
5. **Choose Events**: Select which event types to listen for
|
|
145
|
-
6. **Test**: Send a message to your bot to verify the trigger works
|
|
146
|
-
|
|
147
|
-
## Example Workflows
|
|
148
|
-
|
|
149
|
-
### 1. Simple Echo Bot
|
|
150
|
-
|
|
151
|
-
This workflow creates a bot that echoes back any message it receives:
|
|
152
|
-
|
|
153
|
-
```json
|
|
154
|
-
{
|
|
155
|
-
"nodes": [
|
|
156
|
-
{
|
|
157
|
-
"name": "Max Trigger",
|
|
158
|
-
"type": "n8n-nodes-max.maxTrigger",
|
|
159
|
-
"position": [250, 300],
|
|
160
|
-
"parameters": {
|
|
161
|
-
"events": ["message_created"]
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"name": "Echo Response",
|
|
166
|
-
"type": "n8n-nodes-max.max",
|
|
167
|
-
"position": [450, 300],
|
|
168
|
-
"parameters": {
|
|
169
|
-
"resource": "message",
|
|
170
|
-
"operation": "sendMessage",
|
|
171
|
-
"chatId": "={{$node['Max Trigger'].json['chat']['id']}}",
|
|
172
|
-
"text": "You said: {{$node['Max Trigger'].json['message']['text']}}"
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
],
|
|
176
|
-
"connections": {
|
|
177
|
-
"Max Trigger": {
|
|
178
|
-
"main": [
|
|
179
|
-
[
|
|
180
|
-
{
|
|
181
|
-
"node": "Echo Response",
|
|
182
|
-
"type": "main",
|
|
183
|
-
"index": 0
|
|
184
|
-
}
|
|
185
|
-
]
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
```
|
|
23
|
+
### Альтернативный способ (переменная окружения)
|
|
191
24
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
```json
|
|
197
|
-
{
|
|
198
|
-
"nodes": [
|
|
199
|
-
{
|
|
200
|
-
"name": "Watch Folder",
|
|
201
|
-
"type": "n8n-nodes-base.localFileTrigger",
|
|
202
|
-
"position": [250, 300],
|
|
203
|
-
"parameters": {
|
|
204
|
-
"path": "/path/to/watch",
|
|
205
|
-
"triggerOn": "fileAdded"
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"name": "Send File",
|
|
210
|
-
"type": "n8n-nodes-max.max",
|
|
211
|
-
"position": [450, 300],
|
|
212
|
-
"parameters": {
|
|
213
|
-
"resource": "message",
|
|
214
|
-
"operation": "sendMessage",
|
|
215
|
-
"chatId": "YOUR_CHAT_ID",
|
|
216
|
-
"text": "New file uploaded: {{$node['Watch Folder'].json['name']}}",
|
|
217
|
-
"additionalFields": {
|
|
218
|
-
"attachments": {
|
|
219
|
-
"attachment": [
|
|
220
|
-
{
|
|
221
|
-
"type": "file",
|
|
222
|
-
"binaryData": true,
|
|
223
|
-
"binaryProperty": "data"
|
|
224
|
-
}
|
|
225
|
-
]
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### 3. Interactive Menu Bot
|
|
235
|
-
|
|
236
|
-
This workflow creates a bot with an interactive menu:
|
|
237
|
-
|
|
238
|
-
```json
|
|
239
|
-
{
|
|
240
|
-
"nodes": [
|
|
241
|
-
{
|
|
242
|
-
"name": "Max Trigger",
|
|
243
|
-
"type": "n8n-nodes-max.maxTrigger",
|
|
244
|
-
"position": [250, 300],
|
|
245
|
-
"parameters": {
|
|
246
|
-
"events": ["message_created", "message_callback"]
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"name": "Check Message Type",
|
|
251
|
-
"type": "n8n-nodes-base.if",
|
|
252
|
-
"position": [450, 300],
|
|
253
|
-
"parameters": {
|
|
254
|
-
"conditions": {
|
|
255
|
-
"string": [
|
|
256
|
-
{
|
|
257
|
-
"value1": "={{$node['Max Trigger'].json['event_type']}}",
|
|
258
|
-
"value2": "message_created"
|
|
259
|
-
}
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"name": "Send Menu",
|
|
266
|
-
"type": "n8n-nodes-max.max",
|
|
267
|
-
"position": [650, 200],
|
|
268
|
-
"parameters": {
|
|
269
|
-
"resource": "message",
|
|
270
|
-
"operation": "sendMessage",
|
|
271
|
-
"chatId": "={{$node['Max Trigger'].json['chat']['id']}}",
|
|
272
|
-
"text": "Choose an option:",
|
|
273
|
-
"additionalFields": {
|
|
274
|
-
"keyboard": {
|
|
275
|
-
"keyboardType": "inline",
|
|
276
|
-
"inlineKeyboard": {
|
|
277
|
-
"rows": [
|
|
278
|
-
{
|
|
279
|
-
"buttons": [
|
|
280
|
-
{
|
|
281
|
-
"text": "Option 1",
|
|
282
|
-
"type": "callback",
|
|
283
|
-
"payload": "option_1"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"text": "Option 2",
|
|
287
|
-
"type": "callback",
|
|
288
|
-
"payload": "option_2"
|
|
289
|
-
}
|
|
290
|
-
]
|
|
291
|
-
}
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"name": "Handle Callback",
|
|
300
|
-
"type": "n8n-nodes-max.max",
|
|
301
|
-
"position": [650, 400],
|
|
302
|
-
"parameters": {
|
|
303
|
-
"resource": "message",
|
|
304
|
-
"operation": "answerCallbackQuery",
|
|
305
|
-
"callbackQueryId": "={{$node['Max Trigger'].json['callback']['id']}}",
|
|
306
|
-
"text": "You selected: {{$node['Max Trigger'].json['callback']['payload']}}"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
### 4. Customer Support Bot
|
|
314
|
-
|
|
315
|
-
This workflow creates a customer support bot that categorizes inquiries:
|
|
316
|
-
|
|
317
|
-
```json
|
|
318
|
-
{
|
|
319
|
-
"nodes": [
|
|
320
|
-
{
|
|
321
|
-
"name": "Max Trigger",
|
|
322
|
-
"type": "n8n-nodes-max.maxTrigger",
|
|
323
|
-
"position": [250, 300]
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
"name": "Categorize Inquiry",
|
|
327
|
-
"type": "n8n-nodes-base.if",
|
|
328
|
-
"position": [450, 300],
|
|
329
|
-
"parameters": {
|
|
330
|
-
"conditions": {
|
|
331
|
-
"string": [
|
|
332
|
-
{
|
|
333
|
-
"value1": "={{$node['Max Trigger'].json['message']['text'].toLowerCase()}}",
|
|
334
|
-
"operation": "contains",
|
|
335
|
-
"value2": "billing"
|
|
336
|
-
}
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"name": "Billing Response",
|
|
343
|
-
"type": "n8n-nodes-max.max",
|
|
344
|
-
"position": [650, 200],
|
|
345
|
-
"parameters": {
|
|
346
|
-
"resource": "message",
|
|
347
|
-
"operation": "sendMessage",
|
|
348
|
-
"chatId": "={{$node['Max Trigger'].json['chat']['id']}}",
|
|
349
|
-
"text": "I'll connect you with our billing department. Please wait..."
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
"name": "General Response",
|
|
354
|
-
"type": "n8n-nodes-max.max",
|
|
355
|
-
"position": [650, 400],
|
|
356
|
-
"parameters": {
|
|
357
|
-
"resource": "message",
|
|
358
|
-
"operation": "sendMessage",
|
|
359
|
-
"chatId": "={{$node['Max Trigger'].json['chat']['id']}}",
|
|
360
|
-
"text": "Thank you for contacting us. How can I help you today?"
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
]
|
|
364
|
-
}
|
|
25
|
+
Добавьте пакет в переменную окружения:
|
|
26
|
+
```bash
|
|
27
|
+
export N8N_CUSTOM_EXTENSIONS=n8n-nodes-max
|
|
365
28
|
```
|
|
366
29
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
#### 1. "Invalid Bot Token" Error
|
|
372
|
-
|
|
373
|
-
**Problem**: Credentials test fails with authentication error.
|
|
374
|
-
|
|
375
|
-
**Solutions**:
|
|
376
|
-
- Verify your bot token is correct and hasn't expired
|
|
377
|
-
- Ensure your bot is active (not deleted or suspended)
|
|
378
|
-
- Check that you're using the token from @MasterBot, not another bot platform
|
|
379
|
-
- Try creating a new bot token if the issue persists
|
|
380
|
-
|
|
381
|
-
#### 2. "Chat Not Found" Error
|
|
382
|
-
|
|
383
|
-
**Problem**: Cannot send messages to a specific chat or user.
|
|
384
|
-
|
|
385
|
-
**Solutions**:
|
|
386
|
-
- Verify the chat ID or user ID is correct
|
|
387
|
-
- Ensure the bot has been added to the group chat (for group messages)
|
|
388
|
-
- Check that the user hasn't blocked your bot
|
|
389
|
-
- For new chats, the user must initiate contact with the bot first
|
|
390
|
-
|
|
391
|
-
#### 3. "File Upload Failed" Error
|
|
392
|
-
|
|
393
|
-
**Problem**: Attachment uploads fail or timeout.
|
|
394
|
-
|
|
395
|
-
**Solutions**:
|
|
396
|
-
- Check file size limits (Max messenger has specific limits per file type)
|
|
397
|
-
- Verify file format is supported by Max messenger
|
|
398
|
-
- Ensure stable internet connection for large file uploads
|
|
399
|
-
- Try using binary data input instead of file paths
|
|
400
|
-
- Check file permissions if using local file paths
|
|
401
|
-
|
|
402
|
-
#### 4. "Rate Limit Exceeded" Error
|
|
403
|
-
|
|
404
|
-
**Problem**: Too many API requests in a short time period.
|
|
405
|
-
|
|
406
|
-
**Solutions**:
|
|
407
|
-
- Implement delays between messages using Wait nodes
|
|
408
|
-
- Reduce the frequency of your workflow executions
|
|
409
|
-
- Use batch processing for multiple messages
|
|
410
|
-
- Monitor your API usage and implement proper rate limiting
|
|
411
|
-
|
|
412
|
-
#### 5. Webhook Not Receiving Events
|
|
413
|
-
|
|
414
|
-
**Problem**: Max Trigger node doesn't receive messages or events.
|
|
415
|
-
|
|
416
|
-
**Solutions**:
|
|
417
|
-
- Verify webhook URL is accessible from the internet
|
|
418
|
-
- Check that your n8n instance is publicly reachable
|
|
419
|
-
- Ensure the webhook is properly registered with Max API
|
|
420
|
-
- Test with a simple message to your bot
|
|
421
|
-
- Check n8n logs for webhook registration errors
|
|
422
|
-
|
|
423
|
-
#### 6. Keyboard Buttons Not Working
|
|
424
|
-
|
|
425
|
-
**Problem**: Inline keyboard buttons don't respond or cause errors.
|
|
426
|
-
|
|
427
|
-
**Solutions**:
|
|
428
|
-
- Verify button payload format is correct
|
|
429
|
-
- Ensure callback query handling is implemented
|
|
430
|
-
- Check button text length (Max messenger has limits)
|
|
431
|
-
- Validate keyboard structure (max buttons per row)
|
|
432
|
-
- Test with simple callback buttons first
|
|
433
|
-
|
|
434
|
-
#### 7. Message Formatting Issues
|
|
435
|
-
|
|
436
|
-
**Problem**: HTML or Markdown formatting doesn't display correctly.
|
|
437
|
-
|
|
438
|
-
**Solutions**:
|
|
439
|
-
- Verify HTML tags are properly closed and nested
|
|
440
|
-
- Check Markdown syntax is correct
|
|
441
|
-
- Ensure special characters are properly escaped
|
|
442
|
-
- Test formatting with simple examples first
|
|
443
|
-
- Use plain text if formatting continues to fail
|
|
30
|
+
**Полезные ссылки:**
|
|
31
|
+
- [Официальная документация по установке community nodes](https://docs.n8n.io/integrations/community-nodes/installation/)
|
|
32
|
+
- [Руководство по self-hosted установке](https://docs.n8n.io/hosting/)
|
|
444
33
|
|
|
445
|
-
|
|
34
|
+
## Возможности
|
|
446
35
|
|
|
447
|
-
|
|
36
|
+
### Сообщения
|
|
37
|
+
- Отправка текстовых сообщений с форматированием
|
|
38
|
+
- Редактирование и удаление сообщений
|
|
39
|
+
- Отправка файлов (изображения, видео, аудио, документы)
|
|
40
|
+
- Интерактивные клавиатуры с кнопками
|
|
448
41
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
4. Enable "Always Output Data" in node settings to see all response data
|
|
42
|
+
### Чаты
|
|
43
|
+
- Получение информации о чате
|
|
44
|
+
- Выход из групповых чатов
|
|
453
45
|
|
|
454
|
-
###
|
|
46
|
+
### Триггер
|
|
47
|
+
- Получение событий в реальном времени:
|
|
48
|
+
- Новые сообщения
|
|
49
|
+
- Нажатия на кнопки
|
|
50
|
+
- События чатов
|
|
455
51
|
|
|
456
|
-
|
|
52
|
+
## Настройка
|
|
457
53
|
|
|
458
|
-
1.
|
|
459
|
-
2.
|
|
460
|
-
3.
|
|
461
|
-
4. Provide detailed error messages and workflow configurations when seeking help
|
|
54
|
+
1. Создайте бота через @MasterBot в Max мессенджере
|
|
55
|
+
2. Получите токен доступа
|
|
56
|
+
3. Добавьте токен в настройки ноды в n8n
|
|
462
57
|
|
|
463
|
-
##
|
|
58
|
+
## Быстрый старт
|
|
464
59
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
60
|
+
### Отправка сообщения
|
|
61
|
+
1. Добавьте ноду Max в workflow
|
|
62
|
+
2. Выберите операцию "Send Message"
|
|
63
|
+
3. Укажите ID чата и текст сообщения
|
|
64
|
+
4. Запустите workflow
|
|
470
65
|
|
|
471
|
-
|
|
66
|
+
### Получение сообщений
|
|
67
|
+
1. Добавьте ноду Max Trigger
|
|
68
|
+
2. Настройте webhook
|
|
69
|
+
3. Выберите типы событий для отслеживания
|
|
472
70
|
|
|
473
|
-
|
|
474
|
-
- Initial release with comprehensive Max messenger integration
|
|
475
|
-
- Support for message sending, editing, and deletion
|
|
476
|
-
- File attachment handling (images, videos, audio, documents)
|
|
477
|
-
- Inline keyboard creation with callback support
|
|
478
|
-
- Chat management operations
|
|
479
|
-
- Webhook trigger node for real-time events
|
|
480
|
-
- Comprehensive error handling and validation
|
|
481
|
-
- Full test coverage with integration tests
|
|
71
|
+
## Ресурсы
|
|
482
72
|
|
|
483
|
-
|
|
484
|
-
-
|
|
485
|
-
- Advanced chat administration features
|
|
486
|
-
- Message scheduling capabilities
|
|
487
|
-
- Analytics and usage tracking
|
|
488
|
-
- Enhanced file management options
|
|
73
|
+
- [Документация Max Bot API](https://dev.max.ru/docs/chatbots/bots-coding/library/js)
|
|
74
|
+
- [GitHub репозиторий](https://github.com/pfrankov/n8n-nodes-max)
|
|
489
75
|
|
|
490
|
-
##
|
|
76
|
+
## Лицензия
|
|
491
77
|
|
|
492
78
|
[MIT](LICENSE.md)
|
|
@@ -87,3 +87,4 @@ export declare function validateKeyboardLayout(buttons: IButtonConfig[][]): void
|
|
|
87
87
|
export declare function formatInlineKeyboard(buttons: IButtonConfig[][]): IMaxKeyboard;
|
|
88
88
|
export declare function createInlineKeyboardAttachment(buttons: IButtonConfig[][]): IMaxAttachment;
|
|
89
89
|
export declare function processKeyboardFromParameters(this: IExecuteFunctions, index: number): IMaxAttachment | null;
|
|
90
|
+
export declare function processKeyboardFromAdditionalFields(keyboardData: IDataObject): IMaxAttachment | null;
|
|
@@ -58,6 +58,7 @@ exports.validateKeyboardLayout = validateKeyboardLayout;
|
|
|
58
58
|
exports.formatInlineKeyboard = formatInlineKeyboard;
|
|
59
59
|
exports.createInlineKeyboardAttachment = createInlineKeyboardAttachment;
|
|
60
60
|
exports.processKeyboardFromParameters = processKeyboardFromParameters;
|
|
61
|
+
exports.processKeyboardFromAdditionalFields = processKeyboardFromAdditionalFields;
|
|
61
62
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
62
63
|
const max_bot_api_1 = require("@maxhub/max-bot-api");
|
|
63
64
|
const crypto_1 = require("crypto");
|
|
@@ -376,8 +377,8 @@ async function handleMaxApiError(error, operation, retryCount = 0, maxRetries =
|
|
|
376
377
|
});
|
|
377
378
|
}
|
|
378
379
|
function validateInputParameters(recipientType, recipientId, text, format) {
|
|
379
|
-
if (
|
|
380
|
-
throw new Error(`Invalid ${recipientType} ID: must be a
|
|
380
|
+
if (recipientId === undefined || recipientId === null || isNaN(recipientId)) {
|
|
381
|
+
throw new Error(`Invalid ${recipientType} ID: must be a number`);
|
|
381
382
|
}
|
|
382
383
|
if (text === null || text === undefined || typeof text !== 'string') {
|
|
383
384
|
throw new Error('Message text is required and must be a string');
|
|
@@ -647,8 +648,8 @@ function validateKeyboardButton(button) {
|
|
|
647
648
|
}
|
|
648
649
|
}
|
|
649
650
|
async function getChatInfo(_bot, chatId) {
|
|
650
|
-
if (!chatId || isNaN(chatId)
|
|
651
|
-
throw new Error('Chat ID is required and must be a
|
|
651
|
+
if (!chatId || isNaN(chatId)) {
|
|
652
|
+
throw new Error('Chat ID is required and must be a number');
|
|
652
653
|
}
|
|
653
654
|
try {
|
|
654
655
|
const credentials = await this.getCredentials('maxApi');
|
|
@@ -669,8 +670,8 @@ async function getChatInfo(_bot, chatId) {
|
|
|
669
670
|
}
|
|
670
671
|
}
|
|
671
672
|
async function leaveChat(_bot, chatId) {
|
|
672
|
-
if (!chatId || isNaN(chatId)
|
|
673
|
-
throw new Error('Chat ID is required and must be a
|
|
673
|
+
if (!chatId || isNaN(chatId)) {
|
|
674
|
+
throw new Error('Chat ID is required and must be a number');
|
|
674
675
|
}
|
|
675
676
|
try {
|
|
676
677
|
const credentials = await this.getCredentials('maxApi');
|
|
@@ -783,4 +784,31 @@ function processKeyboardFromParameters(index) {
|
|
|
783
784
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to process inline keyboard: ${error.message}`);
|
|
784
785
|
}
|
|
785
786
|
}
|
|
787
|
+
function processKeyboardFromAdditionalFields(keyboardData) {
|
|
788
|
+
if (!keyboardData || !keyboardData['buttons'] || !Array.isArray(keyboardData['buttons']) || keyboardData['buttons'].length === 0) {
|
|
789
|
+
return null;
|
|
790
|
+
}
|
|
791
|
+
try {
|
|
792
|
+
const buttonRows = [];
|
|
793
|
+
for (const rowData of keyboardData['buttons']) {
|
|
794
|
+
if (rowData.row && rowData.row.button && Array.isArray(rowData.row.button) && rowData.row.button.length > 0) {
|
|
795
|
+
const row = rowData.row.button.map((buttonData) => ({
|
|
796
|
+
text: buttonData.text || '',
|
|
797
|
+
type: buttonData.type || 'callback',
|
|
798
|
+
payload: buttonData.payload || undefined,
|
|
799
|
+
url: buttonData.url || undefined,
|
|
800
|
+
intent: buttonData.intent || 'default',
|
|
801
|
+
}));
|
|
802
|
+
buttonRows.push(row);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (buttonRows.length === 0) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
return createInlineKeyboardAttachment(buttonRows);
|
|
809
|
+
}
|
|
810
|
+
catch (error) {
|
|
811
|
+
throw new Error(`Failed to process inline keyboard: ${error.message}`);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
786
814
|
//# sourceMappingURL=GenericFunctions.js.map
|