---
title: "Construct message"
method: POST
path: "/answers/constructor"
tags: ["messages"]
---

# Construct message

`POST /answers/constructor`

## Request

- Base URL: `https://botapi.tamtam.chat`
- URL: `https://botapi.tamtam.chat/answers/constructor`
- Auth: API key in query parameter `access_token`

Sends answer on construction request. Answer can contain any prepared message and/or keyboard to help user interact with bot.

## Query parameters

- `session_id` string, required

## Request body

- ConstructorAnswer: Bot's answer on construction request
  - `messages` ConstructedMessageBody[]: Array of prepared messages. This messages will be sent as user taps on "Send" button
    - `text` string, nullable: Message text
    - `attachments` AttachmentRequest[], nullable: Message attachments. See `AttachmentRequest` and it's inheritors for full information
      - `type` string, required
    - `markup` MarkupElement[], nullable: Text markup
      - `type` string, required: Type of the markup element. Can be **strong**, *emphasized*, ~strikethrough~, ++underline++, `monospaced`, link or user_mention
      - `from` integer, required: Element start index (zero-based) in text
      - `length` integer, required: Length of the markup element
    - `format` 'markdown' | 'html': Message text format
  - `allow_user_input` boolean: If `true` user can send any input manually. Otherwise, only keyboard will be shown
  - `hint` string, nullable: Hint to user. Will be shown on top of keyboard
  - `data` string: In this property you can store any additional data up to 8KB. We send this data back to bot within the next construction request. It is handy to store here any state of construction session
  - `keyboard` Keyboard: Keyboard is two-dimension array of buttons
    - `buttons` array[], required
      - Button[]
        - `type` string, required
        - `text` string, required: Visible text of button
  - `placeholder` string, nullable: Text to show over the text field

## Response `200`

Success or not result

- SimpleQueryResult: Simple response to request
  - `success` boolean, required: `true` if request was successful. `false` otherwise
  - `message` string: Explanatory message if the result is not successful

## Other responses

- `401`: Authorization Error. No `access_token` provided or token is invalid
- `405`: Method is not allowed
- `500`: Internal Server Error

## Changes

- **2021-06-02** `137e3d1e0b4f`: 2 info
  - added `highlighted` discriminator mapping keys to the `messages/items/markup/items/` request property
  - removed `code` discriminator mapping keys from the `messages/items/markup/items/` request property
- **2021-05-31** `dc45288cfedc`: 1 breaking, 2 warning, 4 info
  - the `keyboard/allOf[#/components/schemas/Keyboard]/buttons/items/items/text` request property's minLength was increased from `0` to `1`
  - removed the request property `messages/items/link`
  - removed the request property `messages/items/notify`
  - added the new optional request property `messages/items/format`
  - …3 more
- **2019-12-12** `1fa16652454b`: 1 breaking, 1 info
  - the `data` request property type changed from `string,` to `string`
  - added `share` discriminator mapping keys to the `messages/items/attachments/items/` request property
- **2019-11-13** `79f5d436b026`: 1 info
  - the `data` request property's maxLength was increased from `4096` to `8192`
- **2019-11-12** `98083e9105a3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/tamtam/apis/tamtam-bot-api/changes/answers/constructor/post.md)

---

[API](https://skmtc.dev/tamtam/apis/tamtam-bot-api.md) - [All operations](https://skmtc.dev/tamtam/apis/tamtam-bot-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tamtam/apis/tamtam-bot-api/revisions/fa85402ea716?raw)
