@hubex/mcp 0.11.20261111 → 0.12.20261114

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.
@@ -0,0 +1,1472 @@
1
+ {
2
+ "openapi": "3.0.1",
3
+ "info": {
4
+ "title": "API for MAX integration in HubEx",
5
+ "description": "Methods for MAX bot management, Mini App authorization, and MAX notification enqueueing",
6
+ "contact": {
7
+ "name": "SmartService Development Team",
8
+ "email": "fmbackend@melston.ru"
9
+ },
10
+ "version": "v1.0.0.0"
11
+ },
12
+ "servers": [
13
+ {
14
+ "url": "https://dev-api.hubex.ru/fsm/MAX"
15
+ }
16
+ ],
17
+ "paths": {
18
+ "/Auth": {
19
+ "post": {
20
+ "tags": [
21
+ "Auth"
22
+ ],
23
+ "summary": "Авторизует пользователя MAX Mini App и возвращает стандартные HubEx токены.",
24
+ "description": "В ответе вместе с токенами возвращаются только дефолты заявки из настроек бота\r\n(`taskTypeId`, `criticalityId`), если они заданы. Полные настройки бота и CRUD заявок\r\nчерез этот метод не отдаются.\r\n \r\n## Пример запроса:\r\n```http\r\nPOST /Auth\r\nContent-Type: application/json\r\n \r\n{\r\n \"initData\": \"query_id=AAE...&user=%7B...%7D&auth_date=1710000000&hash=...\"\r\n}\r\n```",
25
+ "parameters": [
26
+ {
27
+ "name": "X-Application-ID",
28
+ "in": "header",
29
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
30
+ "schema": {
31
+ "enum": [
32
+ 1,
33
+ 2,
34
+ 3,
35
+ 4,
36
+ 5,
37
+ 6
38
+ ],
39
+ "type": "integer",
40
+ "format": "int32",
41
+ "default": 3,
42
+ "x-enumNames": [
43
+ "EngineerMobile",
44
+ "CustomerMobile",
45
+ "MainWeb",
46
+ "AdminWeb",
47
+ "Api",
48
+ "PlateWeb"
49
+ ]
50
+ }
51
+ }
52
+ ],
53
+ "requestBody": {
54
+ "description": "Строка `initData` из Mini App. В теле запроса не допускаются дополнительные поля.",
55
+ "content": {
56
+ "application/json": {
57
+ "schema": {
58
+ "$ref": "#/components/schemas/MaxAuthRequest"
59
+ }
60
+ },
61
+ "text/json": {
62
+ "schema": {
63
+ "$ref": "#/components/schemas/MaxAuthRequest"
64
+ }
65
+ },
66
+ "application/*+json": {
67
+ "schema": {
68
+ "$ref": "#/components/schemas/MaxAuthRequest"
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "responses": {
74
+ "200": {
75
+ "description": "Авторизация выполнена.",
76
+ "content": {
77
+ "text/plain": {
78
+ "schema": {
79
+ "$ref": "#/components/schemas/MaxAuthResponse"
80
+ }
81
+ },
82
+ "application/json": {
83
+ "schema": {
84
+ "$ref": "#/components/schemas/MaxAuthResponse"
85
+ }
86
+ },
87
+ "text/json": {
88
+ "schema": {
89
+ "$ref": "#/components/schemas/MaxAuthResponse"
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "400": {
95
+ "description": "Некорректный запрос или `initData`.",
96
+ "content": {
97
+ "text/plain": {
98
+ "schema": {
99
+ "$ref": "#/components/schemas/ProblemDetails"
100
+ }
101
+ },
102
+ "application/json": {
103
+ "schema": {
104
+ "$ref": "#/components/schemas/ProblemDetails"
105
+ }
106
+ },
107
+ "text/json": {
108
+ "schema": {
109
+ "$ref": "#/components/schemas/ProblemDetails"
110
+ }
111
+ }
112
+ }
113
+ },
114
+ "401": {
115
+ "description": "Подпись `initData` не прошла проверку.",
116
+ "content": {
117
+ "text/plain": {
118
+ "schema": {
119
+ "$ref": "#/components/schemas/ProblemDetails"
120
+ }
121
+ },
122
+ "application/json": {
123
+ "schema": {
124
+ "$ref": "#/components/schemas/ProblemDetails"
125
+ }
126
+ },
127
+ "text/json": {
128
+ "schema": {
129
+ "$ref": "#/components/schemas/ProblemDetails"
130
+ }
131
+ }
132
+ }
133
+ },
134
+ "404": {
135
+ "description": "MAX-бот или пользователь не найден.",
136
+ "content": {
137
+ "text/plain": {
138
+ "schema": {
139
+ "$ref": "#/components/schemas/ProblemDetails"
140
+ }
141
+ },
142
+ "application/json": {
143
+ "schema": {
144
+ "$ref": "#/components/schemas/ProblemDetails"
145
+ }
146
+ },
147
+ "text/json": {
148
+ "schema": {
149
+ "$ref": "#/components/schemas/ProblemDetails"
150
+ }
151
+ }
152
+ }
153
+ },
154
+ "502": {
155
+ "description": "Ошибка внешнего AUTHN/AUTHZ сервиса."
156
+ }
157
+ }
158
+ }
159
+ },
160
+ "/Bot": {
161
+ "get": {
162
+ "tags": [
163
+ "Bot"
164
+ ],
165
+ "summary": "Возвращает список MAX-ботов текущего tenant-а.",
166
+ "description": "## Пример запроса:\r\n```http\r\nGET /Bot\r\nAuthorization: Bearer {access_token}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotList**",
167
+ "parameters": [
168
+ {
169
+ "name": "X-Application-ID",
170
+ "in": "header",
171
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
172
+ "schema": {
173
+ "enum": [
174
+ 1,
175
+ 2,
176
+ 3,
177
+ 4,
178
+ 5,
179
+ 6
180
+ ],
181
+ "type": "integer",
182
+ "format": "int32",
183
+ "default": 3,
184
+ "x-enumNames": [
185
+ "EngineerMobile",
186
+ "CustomerMobile",
187
+ "MainWeb",
188
+ "AdminWeb",
189
+ "Api",
190
+ "PlateWeb"
191
+ ]
192
+ }
193
+ }
194
+ ],
195
+ "responses": {
196
+ "200": {
197
+ "description": "Список ботов найден.",
198
+ "content": {
199
+ "text/plain": {
200
+ "schema": {
201
+ "type": "array",
202
+ "items": {
203
+ "$ref": "#/components/schemas/BotResponse"
204
+ }
205
+ }
206
+ },
207
+ "application/json": {
208
+ "schema": {
209
+ "type": "array",
210
+ "items": {
211
+ "$ref": "#/components/schemas/BotResponse"
212
+ }
213
+ }
214
+ },
215
+ "text/json": {
216
+ "schema": {
217
+ "type": "array",
218
+ "items": {
219
+ "$ref": "#/components/schemas/BotResponse"
220
+ }
221
+ }
222
+ }
223
+ }
224
+ },
225
+ "401": {
226
+ "description": "Отсутствует авторизация или tenant claim.",
227
+ "content": {
228
+ "text/plain": {
229
+ "schema": {
230
+ "$ref": "#/components/schemas/ProblemDetails"
231
+ }
232
+ },
233
+ "application/json": {
234
+ "schema": {
235
+ "$ref": "#/components/schemas/ProblemDetails"
236
+ }
237
+ },
238
+ "text/json": {
239
+ "schema": {
240
+ "$ref": "#/components/schemas/ProblemDetails"
241
+ }
242
+ }
243
+ }
244
+ },
245
+ "403": {
246
+ "description": "Forbidden",
247
+ "content": {
248
+ "text/plain": {
249
+ "schema": {
250
+ "$ref": "#/components/schemas/ProblemDetails"
251
+ }
252
+ },
253
+ "application/json": {
254
+ "schema": {
255
+ "$ref": "#/components/schemas/ProblemDetails"
256
+ }
257
+ },
258
+ "text/json": {
259
+ "schema": {
260
+ "$ref": "#/components/schemas/ProblemDetails"
261
+ }
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "security": [
267
+ {
268
+ "Bearer": [ ]
269
+ }
270
+ ]
271
+ },
272
+ "post": {
273
+ "tags": [
274
+ "Bot"
275
+ ],
276
+ "summary": "Создаёт настройки MAX-бота.",
277
+ "description": "Токен проверяется через MAX `/me`; в ответе токен не возвращается.\r\nЕсли HubEx.INT.MAX.Contract.Bots.BotCreateRequest.ActivateImmediately равен `true`, сервис создаёт вебхук-подписку в MAX.\r\n \r\n## Пример запроса:\r\n```http\r\nPOST /Bot\r\nAuthorization: Bearer {access_token}\r\nContent-Type: application/json\r\n \r\n{\r\n \"token\": \"max-bot-token\",\r\n \"name\": \"HubEx MAX\",\r\n \"taskTypeId\": 1,\r\n \"criticalityId\": 2,\r\n \"welcomeMessage\": \"Добро пожаловать в HubEx.\",\r\n \"contactRequestMessage\": \"Отправьте контакт для привязки аккаунта.\",\r\n \"newMessageText\": \"По заявке появилось новое сообщение.\",\r\n \"taskClosedMessage\": \"Заявка закрыта.\",\r\n \"miniAppUrl\": \"https://miniapp.hubex.ru\",\r\n \"activateImmediately\": true\r\n}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotAdd**",
278
+ "parameters": [
279
+ {
280
+ "name": "X-Application-ID",
281
+ "in": "header",
282
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
283
+ "schema": {
284
+ "enum": [
285
+ 1,
286
+ 2,
287
+ 3,
288
+ 4,
289
+ 5,
290
+ 6
291
+ ],
292
+ "type": "integer",
293
+ "format": "int32",
294
+ "default": 3,
295
+ "x-enumNames": [
296
+ "EngineerMobile",
297
+ "CustomerMobile",
298
+ "MainWeb",
299
+ "AdminWeb",
300
+ "Api",
301
+ "PlateWeb"
302
+ ]
303
+ }
304
+ }
305
+ ],
306
+ "requestBody": {
307
+ "description": "Параметры создаваемого бота.",
308
+ "content": {
309
+ "application/json": {
310
+ "schema": {
311
+ "$ref": "#/components/schemas/BotCreateRequest"
312
+ }
313
+ },
314
+ "text/json": {
315
+ "schema": {
316
+ "$ref": "#/components/schemas/BotCreateRequest"
317
+ }
318
+ },
319
+ "application/*+json": {
320
+ "schema": {
321
+ "$ref": "#/components/schemas/BotCreateRequest"
322
+ }
323
+ }
324
+ }
325
+ },
326
+ "responses": {
327
+ "200": {
328
+ "description": "Бот создан.",
329
+ "content": {
330
+ "text/plain": {
331
+ "schema": {
332
+ "$ref": "#/components/schemas/BotResponse"
333
+ }
334
+ },
335
+ "application/json": {
336
+ "schema": {
337
+ "$ref": "#/components/schemas/BotResponse"
338
+ }
339
+ },
340
+ "text/json": {
341
+ "schema": {
342
+ "$ref": "#/components/schemas/BotResponse"
343
+ }
344
+ }
345
+ }
346
+ },
347
+ "400": {
348
+ "description": "Некорректные параметры или токен MAX.",
349
+ "content": {
350
+ "text/plain": {
351
+ "schema": {
352
+ "$ref": "#/components/schemas/ProblemDetails"
353
+ }
354
+ },
355
+ "application/json": {
356
+ "schema": {
357
+ "$ref": "#/components/schemas/ProblemDetails"
358
+ }
359
+ },
360
+ "text/json": {
361
+ "schema": {
362
+ "$ref": "#/components/schemas/ProblemDetails"
363
+ }
364
+ }
365
+ }
366
+ },
367
+ "401": {
368
+ "description": "Отсутствует авторизация или tenant claim.",
369
+ "content": {
370
+ "text/plain": {
371
+ "schema": {
372
+ "$ref": "#/components/schemas/ProblemDetails"
373
+ }
374
+ },
375
+ "application/json": {
376
+ "schema": {
377
+ "$ref": "#/components/schemas/ProblemDetails"
378
+ }
379
+ },
380
+ "text/json": {
381
+ "schema": {
382
+ "$ref": "#/components/schemas/ProblemDetails"
383
+ }
384
+ }
385
+ }
386
+ },
387
+ "403": {
388
+ "description": "Forbidden",
389
+ "content": {
390
+ "text/plain": {
391
+ "schema": {
392
+ "$ref": "#/components/schemas/ProblemDetails"
393
+ }
394
+ },
395
+ "application/json": {
396
+ "schema": {
397
+ "$ref": "#/components/schemas/ProblemDetails"
398
+ }
399
+ },
400
+ "text/json": {
401
+ "schema": {
402
+ "$ref": "#/components/schemas/ProblemDetails"
403
+ }
404
+ }
405
+ }
406
+ },
407
+ "409": {
408
+ "description": "Конфликт настроек бота.",
409
+ "content": {
410
+ "text/plain": {
411
+ "schema": {
412
+ "$ref": "#/components/schemas/ProblemDetails"
413
+ }
414
+ },
415
+ "application/json": {
416
+ "schema": {
417
+ "$ref": "#/components/schemas/ProblemDetails"
418
+ }
419
+ },
420
+ "text/json": {
421
+ "schema": {
422
+ "$ref": "#/components/schemas/ProblemDetails"
423
+ }
424
+ }
425
+ }
426
+ },
427
+ "502": {
428
+ "description": "Ошибка внешнего MAX API."
429
+ }
430
+ },
431
+ "security": [
432
+ {
433
+ "Bearer": [ ]
434
+ }
435
+ ]
436
+ }
437
+ },
438
+ "/Bot/{botId}": {
439
+ "get": {
440
+ "tags": [
441
+ "Bot"
442
+ ],
443
+ "summary": "Возвращает MAX-бота по идентификатору.",
444
+ "description": "## Пример запроса:\r\n```http\r\nGET /Bot/1001\r\nAuthorization: Bearer {access_token}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotGet**",
445
+ "parameters": [
446
+ {
447
+ "name": "botId",
448
+ "in": "path",
449
+ "description": "Идентификатор MAX-бота.",
450
+ "required": true,
451
+ "schema": {
452
+ "type": "integer",
453
+ "format": "int64"
454
+ }
455
+ },
456
+ {
457
+ "name": "X-Application-ID",
458
+ "in": "header",
459
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
460
+ "schema": {
461
+ "enum": [
462
+ 1,
463
+ 2,
464
+ 3,
465
+ 4,
466
+ 5,
467
+ 6
468
+ ],
469
+ "type": "integer",
470
+ "format": "int32",
471
+ "default": 3,
472
+ "x-enumNames": [
473
+ "EngineerMobile",
474
+ "CustomerMobile",
475
+ "MainWeb",
476
+ "AdminWeb",
477
+ "Api",
478
+ "PlateWeb"
479
+ ]
480
+ }
481
+ }
482
+ ],
483
+ "responses": {
484
+ "200": {
485
+ "description": "Бот найден.",
486
+ "content": {
487
+ "text/plain": {
488
+ "schema": {
489
+ "$ref": "#/components/schemas/BotResponse"
490
+ }
491
+ },
492
+ "application/json": {
493
+ "schema": {
494
+ "$ref": "#/components/schemas/BotResponse"
495
+ }
496
+ },
497
+ "text/json": {
498
+ "schema": {
499
+ "$ref": "#/components/schemas/BotResponse"
500
+ }
501
+ }
502
+ }
503
+ },
504
+ "401": {
505
+ "description": "Отсутствует авторизация или tenant claim.",
506
+ "content": {
507
+ "text/plain": {
508
+ "schema": {
509
+ "$ref": "#/components/schemas/ProblemDetails"
510
+ }
511
+ },
512
+ "application/json": {
513
+ "schema": {
514
+ "$ref": "#/components/schemas/ProblemDetails"
515
+ }
516
+ },
517
+ "text/json": {
518
+ "schema": {
519
+ "$ref": "#/components/schemas/ProblemDetails"
520
+ }
521
+ }
522
+ }
523
+ },
524
+ "403": {
525
+ "description": "Forbidden",
526
+ "content": {
527
+ "text/plain": {
528
+ "schema": {
529
+ "$ref": "#/components/schemas/ProblemDetails"
530
+ }
531
+ },
532
+ "application/json": {
533
+ "schema": {
534
+ "$ref": "#/components/schemas/ProblemDetails"
535
+ }
536
+ },
537
+ "text/json": {
538
+ "schema": {
539
+ "$ref": "#/components/schemas/ProblemDetails"
540
+ }
541
+ }
542
+ }
543
+ },
544
+ "404": {
545
+ "description": "Бот не найден.",
546
+ "content": {
547
+ "text/plain": {
548
+ "schema": {
549
+ "$ref": "#/components/schemas/ProblemDetails"
550
+ }
551
+ },
552
+ "application/json": {
553
+ "schema": {
554
+ "$ref": "#/components/schemas/ProblemDetails"
555
+ }
556
+ },
557
+ "text/json": {
558
+ "schema": {
559
+ "$ref": "#/components/schemas/ProblemDetails"
560
+ }
561
+ }
562
+ }
563
+ }
564
+ },
565
+ "security": [
566
+ {
567
+ "Bearer": [ ]
568
+ }
569
+ ]
570
+ },
571
+ "put": {
572
+ "tags": [
573
+ "Bot"
574
+ ],
575
+ "summary": "Обновляет настройки MAX-бота.",
576
+ "description": "Если передан новый токен, он проверяется через MAX `/me`; в ответе токен не возвращается.\r\n \r\n## Пример запроса:\r\n```http\r\nPUT /Bot/1001\r\nAuthorization: Bearer {access_token}\r\nContent-Type: application/json\r\n \r\n{\r\n \"token\": null,\r\n \"name\": \"HubEx MAX\",\r\n \"taskTypeId\": 1,\r\n \"criticalityId\": 2,\r\n \"welcomeMessage\": \"Добро пожаловать в HubEx.\",\r\n \"contactRequestMessage\": \"Отправьте контакт для привязки аккаунта.\",\r\n \"newMessageText\": \"По заявке появилось новое сообщение.\",\r\n \"taskClosedMessage\": \"Заявка закрыта.\",\r\n \"miniAppUrl\": \"https://miniapp.hubex.ru\"\r\n}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotUpdate**",
577
+ "parameters": [
578
+ {
579
+ "name": "botId",
580
+ "in": "path",
581
+ "description": "Идентификатор MAX-бота.",
582
+ "required": true,
583
+ "schema": {
584
+ "type": "integer",
585
+ "format": "int64"
586
+ }
587
+ },
588
+ {
589
+ "name": "X-Application-ID",
590
+ "in": "header",
591
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
592
+ "schema": {
593
+ "enum": [
594
+ 1,
595
+ 2,
596
+ 3,
597
+ 4,
598
+ 5,
599
+ 6
600
+ ],
601
+ "type": "integer",
602
+ "format": "int32",
603
+ "default": 3,
604
+ "x-enumNames": [
605
+ "EngineerMobile",
606
+ "CustomerMobile",
607
+ "MainWeb",
608
+ "AdminWeb",
609
+ "Api",
610
+ "PlateWeb"
611
+ ]
612
+ }
613
+ }
614
+ ],
615
+ "requestBody": {
616
+ "description": "Новые настройки бота.",
617
+ "content": {
618
+ "application/json": {
619
+ "schema": {
620
+ "$ref": "#/components/schemas/BotUpdateRequest"
621
+ }
622
+ },
623
+ "text/json": {
624
+ "schema": {
625
+ "$ref": "#/components/schemas/BotUpdateRequest"
626
+ }
627
+ },
628
+ "application/*+json": {
629
+ "schema": {
630
+ "$ref": "#/components/schemas/BotUpdateRequest"
631
+ }
632
+ }
633
+ }
634
+ },
635
+ "responses": {
636
+ "200": {
637
+ "description": "Бот обновлён.",
638
+ "content": {
639
+ "text/plain": {
640
+ "schema": {
641
+ "$ref": "#/components/schemas/BotResponse"
642
+ }
643
+ },
644
+ "application/json": {
645
+ "schema": {
646
+ "$ref": "#/components/schemas/BotResponse"
647
+ }
648
+ },
649
+ "text/json": {
650
+ "schema": {
651
+ "$ref": "#/components/schemas/BotResponse"
652
+ }
653
+ }
654
+ }
655
+ },
656
+ "400": {
657
+ "description": "Некорректные параметры.",
658
+ "content": {
659
+ "text/plain": {
660
+ "schema": {
661
+ "$ref": "#/components/schemas/ProblemDetails"
662
+ }
663
+ },
664
+ "application/json": {
665
+ "schema": {
666
+ "$ref": "#/components/schemas/ProblemDetails"
667
+ }
668
+ },
669
+ "text/json": {
670
+ "schema": {
671
+ "$ref": "#/components/schemas/ProblemDetails"
672
+ }
673
+ }
674
+ }
675
+ },
676
+ "401": {
677
+ "description": "Отсутствует авторизация или tenant claim.",
678
+ "content": {
679
+ "text/plain": {
680
+ "schema": {
681
+ "$ref": "#/components/schemas/ProblemDetails"
682
+ }
683
+ },
684
+ "application/json": {
685
+ "schema": {
686
+ "$ref": "#/components/schemas/ProblemDetails"
687
+ }
688
+ },
689
+ "text/json": {
690
+ "schema": {
691
+ "$ref": "#/components/schemas/ProblemDetails"
692
+ }
693
+ }
694
+ }
695
+ },
696
+ "403": {
697
+ "description": "Forbidden",
698
+ "content": {
699
+ "text/plain": {
700
+ "schema": {
701
+ "$ref": "#/components/schemas/ProblemDetails"
702
+ }
703
+ },
704
+ "application/json": {
705
+ "schema": {
706
+ "$ref": "#/components/schemas/ProblemDetails"
707
+ }
708
+ },
709
+ "text/json": {
710
+ "schema": {
711
+ "$ref": "#/components/schemas/ProblemDetails"
712
+ }
713
+ }
714
+ }
715
+ },
716
+ "404": {
717
+ "description": "Бот не найден.",
718
+ "content": {
719
+ "text/plain": {
720
+ "schema": {
721
+ "$ref": "#/components/schemas/ProblemDetails"
722
+ }
723
+ },
724
+ "application/json": {
725
+ "schema": {
726
+ "$ref": "#/components/schemas/ProblemDetails"
727
+ }
728
+ },
729
+ "text/json": {
730
+ "schema": {
731
+ "$ref": "#/components/schemas/ProblemDetails"
732
+ }
733
+ }
734
+ }
735
+ },
736
+ "409": {
737
+ "description": "Конфликт настроек бота.",
738
+ "content": {
739
+ "text/plain": {
740
+ "schema": {
741
+ "$ref": "#/components/schemas/ProblemDetails"
742
+ }
743
+ },
744
+ "application/json": {
745
+ "schema": {
746
+ "$ref": "#/components/schemas/ProblemDetails"
747
+ }
748
+ },
749
+ "text/json": {
750
+ "schema": {
751
+ "$ref": "#/components/schemas/ProblemDetails"
752
+ }
753
+ }
754
+ }
755
+ },
756
+ "502": {
757
+ "description": "Ошибка внешнего MAX API."
758
+ }
759
+ },
760
+ "security": [
761
+ {
762
+ "Bearer": [ ]
763
+ }
764
+ ]
765
+ },
766
+ "delete": {
767
+ "tags": [
768
+ "Bot"
769
+ ],
770
+ "summary": "Удаляет локальные настройки MAX-бота после деактивации вебхук-подписок.",
771
+ "description": "## Пример запроса:\r\n```http\r\nDELETE /Bot/1001\r\nAuthorization: Bearer {access_token}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotDelete**",
772
+ "parameters": [
773
+ {
774
+ "name": "botId",
775
+ "in": "path",
776
+ "description": "Идентификатор MAX-бота.",
777
+ "required": true,
778
+ "schema": {
779
+ "type": "integer",
780
+ "format": "int64"
781
+ }
782
+ },
783
+ {
784
+ "name": "X-Application-ID",
785
+ "in": "header",
786
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
787
+ "schema": {
788
+ "enum": [
789
+ 1,
790
+ 2,
791
+ 3,
792
+ 4,
793
+ 5,
794
+ 6
795
+ ],
796
+ "type": "integer",
797
+ "format": "int32",
798
+ "default": 3,
799
+ "x-enumNames": [
800
+ "EngineerMobile",
801
+ "CustomerMobile",
802
+ "MainWeb",
803
+ "AdminWeb",
804
+ "Api",
805
+ "PlateWeb"
806
+ ]
807
+ }
808
+ }
809
+ ],
810
+ "responses": {
811
+ "204": {
812
+ "description": "Бот удалён."
813
+ },
814
+ "401": {
815
+ "description": "Отсутствует авторизация или tenant claim.",
816
+ "content": {
817
+ "text/plain": {
818
+ "schema": {
819
+ "$ref": "#/components/schemas/ProblemDetails"
820
+ }
821
+ },
822
+ "application/json": {
823
+ "schema": {
824
+ "$ref": "#/components/schemas/ProblemDetails"
825
+ }
826
+ },
827
+ "text/json": {
828
+ "schema": {
829
+ "$ref": "#/components/schemas/ProblemDetails"
830
+ }
831
+ }
832
+ }
833
+ },
834
+ "403": {
835
+ "description": "Forbidden",
836
+ "content": {
837
+ "text/plain": {
838
+ "schema": {
839
+ "$ref": "#/components/schemas/ProblemDetails"
840
+ }
841
+ },
842
+ "application/json": {
843
+ "schema": {
844
+ "$ref": "#/components/schemas/ProblemDetails"
845
+ }
846
+ },
847
+ "text/json": {
848
+ "schema": {
849
+ "$ref": "#/components/schemas/ProblemDetails"
850
+ }
851
+ }
852
+ }
853
+ },
854
+ "404": {
855
+ "description": "Бот не найден.",
856
+ "content": {
857
+ "text/plain": {
858
+ "schema": {
859
+ "$ref": "#/components/schemas/ProblemDetails"
860
+ }
861
+ },
862
+ "application/json": {
863
+ "schema": {
864
+ "$ref": "#/components/schemas/ProblemDetails"
865
+ }
866
+ },
867
+ "text/json": {
868
+ "schema": {
869
+ "$ref": "#/components/schemas/ProblemDetails"
870
+ }
871
+ }
872
+ }
873
+ },
874
+ "502": {
875
+ "description": "Ошибка внешнего MAX API при удалении подписки."
876
+ }
877
+ },
878
+ "security": [
879
+ {
880
+ "Bearer": [ ]
881
+ }
882
+ ]
883
+ }
884
+ },
885
+ "/Bot/{botId}/activate": {
886
+ "put": {
887
+ "tags": [
888
+ "Bot"
889
+ ],
890
+ "summary": "Активирует MAX-бота и создаёт вебхук-подписку в MAX.",
891
+ "description": "## Пример запроса:\r\n```http\r\nPUT /Bot/1001/activate\r\nAuthorization: Bearer {access_token}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotActivate**",
892
+ "parameters": [
893
+ {
894
+ "name": "botId",
895
+ "in": "path",
896
+ "description": "Идентификатор MAX-бота.",
897
+ "required": true,
898
+ "schema": {
899
+ "type": "integer",
900
+ "format": "int64"
901
+ }
902
+ },
903
+ {
904
+ "name": "X-Application-ID",
905
+ "in": "header",
906
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
907
+ "schema": {
908
+ "enum": [
909
+ 1,
910
+ 2,
911
+ 3,
912
+ 4,
913
+ 5,
914
+ 6
915
+ ],
916
+ "type": "integer",
917
+ "format": "int32",
918
+ "default": 3,
919
+ "x-enumNames": [
920
+ "EngineerMobile",
921
+ "CustomerMobile",
922
+ "MainWeb",
923
+ "AdminWeb",
924
+ "Api",
925
+ "PlateWeb"
926
+ ]
927
+ }
928
+ }
929
+ ],
930
+ "responses": {
931
+ "200": {
932
+ "description": "Бот активирован.",
933
+ "content": {
934
+ "text/plain": {
935
+ "schema": {
936
+ "$ref": "#/components/schemas/BotResponse"
937
+ }
938
+ },
939
+ "application/json": {
940
+ "schema": {
941
+ "$ref": "#/components/schemas/BotResponse"
942
+ }
943
+ },
944
+ "text/json": {
945
+ "schema": {
946
+ "$ref": "#/components/schemas/BotResponse"
947
+ }
948
+ }
949
+ }
950
+ },
951
+ "401": {
952
+ "description": "Отсутствует авторизация или tenant claim.",
953
+ "content": {
954
+ "text/plain": {
955
+ "schema": {
956
+ "$ref": "#/components/schemas/ProblemDetails"
957
+ }
958
+ },
959
+ "application/json": {
960
+ "schema": {
961
+ "$ref": "#/components/schemas/ProblemDetails"
962
+ }
963
+ },
964
+ "text/json": {
965
+ "schema": {
966
+ "$ref": "#/components/schemas/ProblemDetails"
967
+ }
968
+ }
969
+ }
970
+ },
971
+ "403": {
972
+ "description": "Forbidden",
973
+ "content": {
974
+ "text/plain": {
975
+ "schema": {
976
+ "$ref": "#/components/schemas/ProblemDetails"
977
+ }
978
+ },
979
+ "application/json": {
980
+ "schema": {
981
+ "$ref": "#/components/schemas/ProblemDetails"
982
+ }
983
+ },
984
+ "text/json": {
985
+ "schema": {
986
+ "$ref": "#/components/schemas/ProblemDetails"
987
+ }
988
+ }
989
+ }
990
+ },
991
+ "404": {
992
+ "description": "Бот не найден.",
993
+ "content": {
994
+ "text/plain": {
995
+ "schema": {
996
+ "$ref": "#/components/schemas/ProblemDetails"
997
+ }
998
+ },
999
+ "application/json": {
1000
+ "schema": {
1001
+ "$ref": "#/components/schemas/ProblemDetails"
1002
+ }
1003
+ },
1004
+ "text/json": {
1005
+ "schema": {
1006
+ "$ref": "#/components/schemas/ProblemDetails"
1007
+ }
1008
+ }
1009
+ }
1010
+ },
1011
+ "502": {
1012
+ "description": "Ошибка внешнего MAX API."
1013
+ }
1014
+ },
1015
+ "security": [
1016
+ {
1017
+ "Bearer": [ ]
1018
+ }
1019
+ ]
1020
+ }
1021
+ },
1022
+ "/Bot/{botId}/deactivate": {
1023
+ "put": {
1024
+ "tags": [
1025
+ "Bot"
1026
+ ],
1027
+ "summary": "Деактивирует MAX-бота и удаляет вебхук-подписки в MAX.",
1028
+ "description": "## Пример запроса:\r\n```http\r\nPUT /Bot/1001/deactivate\r\nAuthorization: Bearer {access_token}\r\n```<br />* Для выполнения данного метода требуется любое из перечисленных полномочий: **MaxBotDeactivate**",
1029
+ "parameters": [
1030
+ {
1031
+ "name": "botId",
1032
+ "in": "path",
1033
+ "description": "Идентификатор MAX-бота.",
1034
+ "required": true,
1035
+ "schema": {
1036
+ "type": "integer",
1037
+ "format": "int64"
1038
+ }
1039
+ },
1040
+ {
1041
+ "name": "X-Application-ID",
1042
+ "in": "header",
1043
+ "description": "Идентификатор приложения. EngineerMobile - 1, CustomerMobile - 2, MainWeb - 3, AdminWeb - 4, Api - 5, PlateWeb - 6",
1044
+ "schema": {
1045
+ "enum": [
1046
+ 1,
1047
+ 2,
1048
+ 3,
1049
+ 4,
1050
+ 5,
1051
+ 6
1052
+ ],
1053
+ "type": "integer",
1054
+ "format": "int32",
1055
+ "default": 3,
1056
+ "x-enumNames": [
1057
+ "EngineerMobile",
1058
+ "CustomerMobile",
1059
+ "MainWeb",
1060
+ "AdminWeb",
1061
+ "Api",
1062
+ "PlateWeb"
1063
+ ]
1064
+ }
1065
+ }
1066
+ ],
1067
+ "responses": {
1068
+ "200": {
1069
+ "description": "Бот деактивирован.",
1070
+ "content": {
1071
+ "text/plain": {
1072
+ "schema": {
1073
+ "$ref": "#/components/schemas/BotResponse"
1074
+ }
1075
+ },
1076
+ "application/json": {
1077
+ "schema": {
1078
+ "$ref": "#/components/schemas/BotResponse"
1079
+ }
1080
+ },
1081
+ "text/json": {
1082
+ "schema": {
1083
+ "$ref": "#/components/schemas/BotResponse"
1084
+ }
1085
+ }
1086
+ }
1087
+ },
1088
+ "401": {
1089
+ "description": "Отсутствует авторизация или tenant claim.",
1090
+ "content": {
1091
+ "text/plain": {
1092
+ "schema": {
1093
+ "$ref": "#/components/schemas/ProblemDetails"
1094
+ }
1095
+ },
1096
+ "application/json": {
1097
+ "schema": {
1098
+ "$ref": "#/components/schemas/ProblemDetails"
1099
+ }
1100
+ },
1101
+ "text/json": {
1102
+ "schema": {
1103
+ "$ref": "#/components/schemas/ProblemDetails"
1104
+ }
1105
+ }
1106
+ }
1107
+ },
1108
+ "403": {
1109
+ "description": "Forbidden",
1110
+ "content": {
1111
+ "text/plain": {
1112
+ "schema": {
1113
+ "$ref": "#/components/schemas/ProblemDetails"
1114
+ }
1115
+ },
1116
+ "application/json": {
1117
+ "schema": {
1118
+ "$ref": "#/components/schemas/ProblemDetails"
1119
+ }
1120
+ },
1121
+ "text/json": {
1122
+ "schema": {
1123
+ "$ref": "#/components/schemas/ProblemDetails"
1124
+ }
1125
+ }
1126
+ }
1127
+ },
1128
+ "404": {
1129
+ "description": "Бот не найден.",
1130
+ "content": {
1131
+ "text/plain": {
1132
+ "schema": {
1133
+ "$ref": "#/components/schemas/ProblemDetails"
1134
+ }
1135
+ },
1136
+ "application/json": {
1137
+ "schema": {
1138
+ "$ref": "#/components/schemas/ProblemDetails"
1139
+ }
1140
+ },
1141
+ "text/json": {
1142
+ "schema": {
1143
+ "$ref": "#/components/schemas/ProblemDetails"
1144
+ }
1145
+ }
1146
+ }
1147
+ },
1148
+ "502": {
1149
+ "description": "Ошибка внешнего MAX API."
1150
+ }
1151
+ },
1152
+ "security": [
1153
+ {
1154
+ "Bearer": [ ]
1155
+ }
1156
+ ]
1157
+ }
1158
+ }
1159
+ },
1160
+ "components": {
1161
+ "schemas": {
1162
+ "BotCreateRequest": {
1163
+ "type": "object",
1164
+ "properties": {
1165
+ "token": {
1166
+ "type": "string",
1167
+ "description": "Токен MAX-бота. Используется только для проверки и сохранения, в ответах API не возвращается.",
1168
+ "nullable": true
1169
+ },
1170
+ "name": {
1171
+ "type": "string",
1172
+ "description": "Отображаемое имя MAX-бота в HubEx.",
1173
+ "nullable": true
1174
+ },
1175
+ "taskTypeId": {
1176
+ "type": "integer",
1177
+ "description": "Идентификатор типа заявки, который будет использоваться для сценариев MAX-онбординга, если задан.",
1178
+ "format": "int32",
1179
+ "nullable": true
1180
+ },
1181
+ "criticalityId": {
1182
+ "type": "integer",
1183
+ "description": "Идентификатор критичности заявки, который будет использоваться для сценариев MAX-онбординга, если задан.",
1184
+ "format": "int32",
1185
+ "nullable": true
1186
+ },
1187
+ "welcomeMessage": {
1188
+ "type": "string",
1189
+ "description": "Текст приветственного сообщения пользователю MAX.",
1190
+ "nullable": true
1191
+ },
1192
+ "contactRequestMessage": {
1193
+ "type": "string",
1194
+ "description": "Текст сообщения с просьбой отправить контакт в MAX.",
1195
+ "nullable": true
1196
+ },
1197
+ "newMessageText": {
1198
+ "type": "string",
1199
+ "description": "Шаблон текста уведомления о новом сообщении по заявке.",
1200
+ "nullable": true
1201
+ },
1202
+ "taskClosedMessage": {
1203
+ "type": "string",
1204
+ "description": "Шаблон текста уведомления о закрытии заявки.",
1205
+ "nullable": true
1206
+ },
1207
+ "miniAppUrl": {
1208
+ "type": "string",
1209
+ "description": "URL HubEx Mini App (веб-хостинг). Не является deep link max.ru — тот строится из Username бота (GET /me).",
1210
+ "nullable": true
1211
+ },
1212
+ "activateImmediately": {
1213
+ "type": "boolean",
1214
+ "description": "Признак необходимости сразу активировать бота и создать вебхук-подписку в MAX."
1215
+ }
1216
+ },
1217
+ "additionalProperties": false,
1218
+ "description": "Запрос создания настроек MAX-бота для tenant-а."
1219
+ },
1220
+ "BotResponse": {
1221
+ "type": "object",
1222
+ "properties": {
1223
+ "botId": {
1224
+ "type": "integer",
1225
+ "description": "Идентификатор MAX-бота в HubEx.",
1226
+ "format": "int64"
1227
+ },
1228
+ "name": {
1229
+ "type": "string",
1230
+ "description": "Отображаемое имя MAX-бота.",
1231
+ "nullable": true
1232
+ },
1233
+ "username": {
1234
+ "type": "string",
1235
+ "description": "Username бота из MAX `GET /me`; используется для deep link `https://max.ru/{username}?startapp=…`.",
1236
+ "nullable": true
1237
+ },
1238
+ "taskTypeId": {
1239
+ "type": "integer",
1240
+ "description": "Идентификатор типа заявки для сценариев MAX-онбординга, если задан.",
1241
+ "format": "int32",
1242
+ "nullable": true
1243
+ },
1244
+ "criticalityId": {
1245
+ "type": "integer",
1246
+ "description": "Идентификатор критичности заявки для сценариев MAX-онбординга, если задан.",
1247
+ "format": "int32",
1248
+ "nullable": true
1249
+ },
1250
+ "welcomeMessage": {
1251
+ "type": "string",
1252
+ "description": "Текст приветственного сообщения пользователю MAX.",
1253
+ "nullable": true
1254
+ },
1255
+ "contactRequestMessage": {
1256
+ "type": "string",
1257
+ "description": "Текст сообщения с просьбой отправить контакт в MAX.",
1258
+ "nullable": true
1259
+ },
1260
+ "newMessageText": {
1261
+ "type": "string",
1262
+ "description": "Шаблон текста уведомления о новом сообщении по заявке.",
1263
+ "nullable": true
1264
+ },
1265
+ "taskClosedMessage": {
1266
+ "type": "string",
1267
+ "description": "Шаблон текста уведомления о закрытии заявки.",
1268
+ "nullable": true
1269
+ },
1270
+ "miniAppUrl": {
1271
+ "type": "string",
1272
+ "description": "URL HubEx Mini App (веб-хостинг), не deep link max.ru.",
1273
+ "nullable": true
1274
+ },
1275
+ "isActive": {
1276
+ "type": "boolean",
1277
+ "description": "Признак активной вебхук-подписки MAX-бота."
1278
+ },
1279
+ "hasToken": {
1280
+ "type": "boolean",
1281
+ "description": "Признак наличия сохранённого токена MAX-бота."
1282
+ },
1283
+ "created": {
1284
+ "type": "string",
1285
+ "description": "Дата и время создания настроек бота в UTC.",
1286
+ "format": "date-time"
1287
+ },
1288
+ "modified": {
1289
+ "type": "string",
1290
+ "description": "Дата и время последнего изменения настроек бота в UTC.",
1291
+ "format": "date-time",
1292
+ "nullable": true
1293
+ }
1294
+ },
1295
+ "additionalProperties": false,
1296
+ "description": "Ответ с настройками MAX-бота без раскрытия сохранённого токена."
1297
+ },
1298
+ "BotUpdateRequest": {
1299
+ "type": "object",
1300
+ "properties": {
1301
+ "token": {
1302
+ "type": "string",
1303
+ "description": "Новый токен MAX-бота. Если не задан, ранее сохранённый токен не меняется.",
1304
+ "nullable": true
1305
+ },
1306
+ "name": {
1307
+ "type": "string",
1308
+ "description": "Отображаемое имя MAX-бота в HubEx.",
1309
+ "nullable": true
1310
+ },
1311
+ "taskTypeId": {
1312
+ "type": "integer",
1313
+ "description": "Идентификатор типа заявки, который будет использоваться для сценариев MAX-онбординга, если задан.",
1314
+ "format": "int32",
1315
+ "nullable": true
1316
+ },
1317
+ "criticalityId": {
1318
+ "type": "integer",
1319
+ "description": "Идентификатор критичности заявки, который будет использоваться для сценариев MAX-онбординга, если задан.",
1320
+ "format": "int32",
1321
+ "nullable": true
1322
+ },
1323
+ "welcomeMessage": {
1324
+ "type": "string",
1325
+ "description": "Текст приветственного сообщения пользователю MAX.",
1326
+ "nullable": true
1327
+ },
1328
+ "contactRequestMessage": {
1329
+ "type": "string",
1330
+ "description": "Текст сообщения с просьбой отправить контакт в MAX.",
1331
+ "nullable": true
1332
+ },
1333
+ "newMessageText": {
1334
+ "type": "string",
1335
+ "description": "Шаблон текста уведомления о новом сообщении по заявке.",
1336
+ "nullable": true
1337
+ },
1338
+ "taskClosedMessage": {
1339
+ "type": "string",
1340
+ "description": "Шаблон текста уведомления о закрытии заявки.",
1341
+ "nullable": true
1342
+ },
1343
+ "miniAppUrl": {
1344
+ "type": "string",
1345
+ "description": "URL HubEx Mini App (веб-хостинг). Не является deep link max.ru — тот строится из Username бота (GET /me).",
1346
+ "nullable": true
1347
+ }
1348
+ },
1349
+ "additionalProperties": false,
1350
+ "description": "Запрос обновления настроек MAX-бота."
1351
+ },
1352
+ "MaxAuthRequest": {
1353
+ "type": "object",
1354
+ "properties": {
1355
+ "initData": {
1356
+ "type": "string",
1357
+ "description": "Строка `initData`, полученная клиентом из MAX Mini App.",
1358
+ "nullable": true
1359
+ }
1360
+ },
1361
+ "additionalProperties": false,
1362
+ "description": "Запрос авторизации пользователя MAX Mini App в HubEx."
1363
+ },
1364
+ "MaxAuthResponse": {
1365
+ "type": "object",
1366
+ "properties": {
1367
+ "access_token": {
1368
+ "type": "string",
1369
+ "description": "Токен доступа HubEx для вызова обычных HubEx API.",
1370
+ "nullable": true
1371
+ },
1372
+ "expires_in": {
1373
+ "type": "integer",
1374
+ "description": "Срок действия токена доступа в секундах, если он возвращён AUTHZ.",
1375
+ "format": "int32",
1376
+ "nullable": true
1377
+ },
1378
+ "jwt_valid_till": {
1379
+ "type": "string",
1380
+ "description": "Дата и время окончания действия токена доступа в UTC, если возвращены AUTHZ.",
1381
+ "format": "date-time",
1382
+ "nullable": true
1383
+ },
1384
+ "refresh_token": {
1385
+ "type": "string",
1386
+ "description": "Токен обновления HubEx для продления сессии Mini App.",
1387
+ "nullable": true
1388
+ },
1389
+ "refresh_expires_in": {
1390
+ "type": "integer",
1391
+ "description": "Срок действия токена обновления в секундах, если он возвращён AUTHZ.",
1392
+ "format": "int32",
1393
+ "nullable": true
1394
+ },
1395
+ "refresh_valid_till": {
1396
+ "type": "string",
1397
+ "description": "Дата и время окончания действия токена обновления в UTC, если возвращены AUTHZ.",
1398
+ "format": "date-time",
1399
+ "nullable": true
1400
+ },
1401
+ "taskTypeId": {
1402
+ "type": "integer",
1403
+ "description": "Дефолтный тип заявки из настроек MAX-бота, если задан.",
1404
+ "format": "int32",
1405
+ "nullable": true
1406
+ },
1407
+ "criticalityId": {
1408
+ "type": "integer",
1409
+ "description": "Дефолтная критичность заявки из настроек MAX-бота, если задана.",
1410
+ "format": "int32",
1411
+ "nullable": true
1412
+ }
1413
+ },
1414
+ "additionalProperties": false,
1415
+ "description": "Ответ авторизации MAX Mini App со стандартными токенами HubEx\r\nи минимальным bootstrap из настроек бота для создания заявки."
1416
+ },
1417
+ "ProblemDetails": {
1418
+ "type": "object",
1419
+ "properties": {
1420
+ "type": {
1421
+ "type": "string",
1422
+ "nullable": true
1423
+ },
1424
+ "title": {
1425
+ "type": "string",
1426
+ "nullable": true
1427
+ },
1428
+ "status": {
1429
+ "type": "integer",
1430
+ "format": "int32",
1431
+ "nullable": true
1432
+ },
1433
+ "detail": {
1434
+ "type": "string",
1435
+ "nullable": true
1436
+ },
1437
+ "instance": {
1438
+ "type": "string",
1439
+ "nullable": true
1440
+ }
1441
+ },
1442
+ "additionalProperties": { }
1443
+ }
1444
+ },
1445
+ "securitySchemes": {
1446
+ "Bearer": {
1447
+ "type": "http",
1448
+ "description": "Введите токен для авторизации",
1449
+ "scheme": "Bearer",
1450
+ "bearerFormat": "JWT"
1451
+ }
1452
+ }
1453
+ },
1454
+ "tags": [
1455
+ {
1456
+ "name": "Auth",
1457
+ "description": "Выполняет авторизацию MAX Mini App пользователя в HubEx."
1458
+ },
1459
+ {
1460
+ "name": "Bot",
1461
+ "description": "Управляет MAX-ботами tenant-а."
1462
+ },
1463
+ {
1464
+ "name": "Auth",
1465
+ "description": "Выполняет авторизацию MAX Mini App пользователя в HubEx."
1466
+ },
1467
+ {
1468
+ "name": "Bot",
1469
+ "description": "Управляет MAX-ботами tenant-а."
1470
+ }
1471
+ ]
1472
+ }