Skip to content

Commit ea4581d

Browse files
committed
Added constructors API
1 parent fcfe403 commit ea4581d

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed

Diff for: schema.yaml

+200
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,36 @@ paths:
962962
$ref: '#/components/responses/NotAllowed'
963963
'500':
964964
$ref: '#/components/responses/InternalError'
965+
/answers/constructor:
966+
post:
967+
tags:
968+
- messages
969+
operationId: construct
970+
description: |-
971+
Sends answer on construction request. Answer can contain any prepared message and/or keyboard to help user interact with bot.
972+
summary: Construct message
973+
parameters:
974+
- name: session_id
975+
description: Constructor session identifier
976+
required: true
977+
in: query
978+
schema:
979+
type: string
980+
requestBody:
981+
required: true
982+
content:
983+
application/json:
984+
schema:
985+
$ref: '#/components/schemas/ConstructorAnswer'
986+
responses:
987+
'200':
988+
$ref: '#/components/responses/SuccessResponse'
989+
'401':
990+
$ref: '#/components/responses/Unauthorized'
991+
'405':
992+
$ref: '#/components/responses/NotAllowed'
993+
'500':
994+
$ref: '#/components/responses/InternalError'
965995
/updates:
966996
get:
967997
operationId: getUpdates
@@ -1454,10 +1484,41 @@ components:
14541484
type: string
14551485
nullable: true
14561486
readOnly: false
1487+
constructor:
1488+
description: Bot-constructor created this message
1489+
readOnly: false
1490+
nullable: true
1491+
allOf:
1492+
- $ref: '#/components/schemas/User'
14571493
required:
14581494
- recipient
14591495
- body
14601496
- timestamp
1497+
ConstructedMessage:
1498+
description: Message constructed i in chat
1499+
properties:
1500+
sender:
1501+
description: User who sent this message
1502+
allOf:
1503+
- $ref: '#/components/schemas/User'
1504+
timestamp:
1505+
description: Unix-time when message has been created
1506+
type: integer
1507+
format: int64
1508+
link:
1509+
description: 'Any linked message: forward or reply'
1510+
nullable: true
1511+
readOnly: false
1512+
allOf:
1513+
- $ref: '#/components/schemas/LinkedMessage'
1514+
body:
1515+
description: Body of created message. Text + attachments
1516+
allOf:
1517+
- $ref: '#/components/schemas/MessageBody'
1518+
required:
1519+
- sender
1520+
- body
1521+
- timestamp
14611522
MessageStat:
14621523
description: Message statistics
14631524
properties:
@@ -1626,6 +1687,28 @@ components:
16261687
type: object
16271688
allOf:
16281689
- $ref: '#/components/schemas/MediaAttachmentPayload'
1690+
thumbnail:
1691+
description: Video thumbnail
1692+
type: string
1693+
nullable: true
1694+
readOnly: false
1695+
allOf:
1696+
- $ref: '#/components/schemas/PhotoAttachmentPayload'
1697+
width:
1698+
description: Video width
1699+
type: integer
1700+
nullable: true
1701+
readOnly: false
1702+
height:
1703+
description: Video height
1704+
type: integer
1705+
nullable: true
1706+
readOnly: false
1707+
duration:
1708+
description: Video duration in seconds
1709+
type: integer
1710+
nullable: true
1711+
readOnly: false
16291712
required:
16301713
- payload
16311714
AudioAttachment:
@@ -2175,6 +2258,42 @@ components:
21752258
nullable: true
21762259
readOnly: false
21772260
type: string
2261+
ConstructorAnswer:
2262+
description: Bot's answer on construction request
2263+
properties:
2264+
messages:
2265+
type: array
2266+
description: Array of prepared messages. This messages will be sent as user taps on "Send" button
2267+
readOnly: false
2268+
items:
2269+
$ref: '#/components/schemas/NewMessageBody'
2270+
allow_user_input:
2271+
description: 'If `true` user can send any input manually. Otherwise, only keyboard will be shown'
2272+
type: boolean
2273+
readOnly: false
2274+
hint:
2275+
description: 'Hint to user. Will be shown on top of keyboard'
2276+
nullable: true
2277+
readOnly: false
2278+
type: string
2279+
data:
2280+
description: |-
2281+
In this property you can store any additional data up to 4KB. We send this data back to bot within the
2282+
next construction request. It is handy to store here any state of construction session
2283+
type: string,
2284+
readOnly: false
2285+
maxLength: 4096
2286+
keyboard:
2287+
description: 'Keyboard to show to user in constructor mode'
2288+
nullable: true
2289+
readOnly: false
2290+
allOf:
2291+
- $ref: '#/components/schemas/Keyboard'
2292+
placeholder:
2293+
nullable: true
2294+
readOnly: false
2295+
description: 'Text to show over the text field of TamTam clients'
2296+
type: string
21782297
Error:
21792298
description: Server returns this if there was an exception to your request
21802299
properties:
@@ -2253,6 +2372,8 @@ components:
22532372
user_removed: '#/components/schemas/UserRemovedFromChatUpdate'
22542373
bot_started: '#/components/schemas/BotStartedUpdate'
22552374
chat_title_changed: '#/components/schemas/ChatTitleChangedUpdate'
2375+
message_construction_request: '#/components/schemas/MessageConstructionRequest'
2376+
message_constructed: '#/components/schemas/MessageConstructedUpdate'
22562377
message_chat_created: '#/components/schemas/MessageChatCreatedUpdate'
22572378
properties:
22582379
update_type:
@@ -2440,6 +2561,85 @@ components:
24402561
- chat_id
24412562
- user
24422563
- title
2564+
MessageConstructionRequest:
2565+
description: Bot will get this update when user sent to bot any message or pressed button during construction process
2566+
allOf:
2567+
- $ref: '#/components/schemas/Update'
2568+
- properties:
2569+
user:
2570+
description: User who initiated this request
2571+
allOf:
2572+
- $ref: '#/components/schemas/UserWithPhoto'
2573+
user_locale:
2574+
description: Current user locale in IETF BCP 47 format
2575+
type: string
2576+
readOnly: false
2577+
session_id:
2578+
description: Constructor session identifier
2579+
type: string
2580+
data:
2581+
description: data received from previous `ConstructorAnswer`
2582+
type: string
2583+
readOnly: false
2584+
nullable: true
2585+
maxLength: 4096
2586+
input:
2587+
description: User's input. It can be message (text/attachments) or simple button's callback
2588+
allOf:
2589+
- $ref: '#/components/schemas/ConstructorInput'
2590+
required:
2591+
- user
2592+
- session_id
2593+
- input
2594+
ConstructorInput:
2595+
description: It can be either message (text/attachments) or button callback
2596+
discriminator:
2597+
propertyName: input_type
2598+
mapping:
2599+
callback: '#/components/schemas/CallbackConstructorInput'
2600+
message: '#/components/schemas/MessageConstructorInput'
2601+
properties:
2602+
input_type:
2603+
type: string
2604+
required:
2605+
- input_type
2606+
CallbackConstructorInput:
2607+
description: Bot will get this input as soon as soon user taps on button created by bot in construction mode
2608+
allOf:
2609+
- $ref: '#/components/schemas/ConstructorInput'
2610+
- properties:
2611+
payload:
2612+
description: Pressed button payload
2613+
type: string
2614+
required:
2615+
- payload
2616+
MessageConstructorInput:
2617+
description: Bot will get this input in case when user sends message to bot manually
2618+
allOf:
2619+
- $ref: '#/components/schemas/ConstructorInput'
2620+
- properties:
2621+
messages:
2622+
description: Messages sent by user during construction process. Typically it is single element array but sometimes it can contains multiple messages. Can be empty on initial request when user just opened constructor
2623+
type: array
2624+
nullable: true
2625+
items:
2626+
$ref: '#/components/schemas/NewMessageBody'
2627+
required:
2628+
- messages
2629+
MessageConstructedUpdate:
2630+
description: Bot will get this update when constructed message has been posted to any chat
2631+
allOf:
2632+
- $ref: '#/components/schemas/Update'
2633+
- properties:
2634+
session_id:
2635+
description: Constructor session identifier
2636+
type: string
2637+
message:
2638+
description: User message
2639+
$ref: '#/components/schemas/ConstructedMessage'
2640+
required:
2641+
- session_id
2642+
- message
24432643
MessageChatCreatedUpdate:
24442644
description: Bot will get this update when chat has been created as soon as first user clicked chat button
24452645
allOf:

0 commit comments

Comments
 (0)