Create a mailing
POST
/create_bm_post/{token}/
Create a mailing over the bot's database in @BotManRobot. The mailing is queued right away. - token
- Bot token from @BotFather - of the same bot as bot_id
Request body (JSON)
| Field | Required | What it is |
|---|---|---|
| bot_id | yes | Bot ID in BotManager (UUID) - the "ID" line in the bot card in @BotManRobot, "My bots" section |
| message_text | no | Post text, Telegram HTML markup |
| image | no | Image: an https link or a file_id received by this same bot. The text becomes the caption |
| sticker | no | Sticker: file_id. With a sticker the text is not sent |
| board_text | no | Buttons under the post, format below |
| speed | no, 60 | Messages per second, up to 1000 |
| speed_fixed | no, false | true - keep the set speed, do not adjust it automatically |
Buttons
Each line is a row of buttons, buttons in a row are separated by |, name and value by -. If the name contains a hyphen, put spaces around the separator: Name - value.
- Website - https://example.com
- Link button
- Open - !!!!https://example.com/app
- Mini app (WebApp)
- Share - !!text
- Choose a chat for an inline query
- Search - !!!text
- Inline query in the same chat
Button color: add !red, !blue or !green (short !r, !b, !g) to its name, for example: Buy !green - https://example.com.
Request example
bash
curl -X POST https://api.botstat.io/create_bm_post/BOT_TOKEN/ \
-H "Content-Type: application/json" \
-d '{"bot_id": "BOT_UUID", "message_text": "<b>Hi!</b> A new feature is live in the bot", "board_text": "Open - https://t.me/examplebot", "speed": 60}'
Keep the token secretThe token is part of the request URL: do not publish such links and do not send the request from users' browsers - only from your server.
Response
json
{
"answer": true,
"desc": "success"
}
| Response | When |
|---|---|
| {"answer": true, "desc": "success"} | Mailing created |
| {"answer": false, "desc": "no have bot"} | No bot with this bot_id in BotManager |
| {"ok": false, "result": {"error_code": "INVALID_TOKEN", …}} - HTTP 401 | The token is wrong or belongs to another bot |
| {"ok": false, "result": {"error_code": "MISSING_PARAMETERS", …}} - HTTP 422 | bot_id is missing |
| {"ok": false, "result": {"error_code": "INVALID_PARAMETERS", …}} - HTTP 422 | bot_id is not a UUID or a field has the wrong type |
| {"ok": false, "result": {"error_code": "RATE_LIMITED", …}} - HTTP 429 | More than 5 requests per second from one address. Retry in a second |
| {"ok": false, "result": {"error_code": "INTERNAL_ERROR", …}} - HTTP 500 | The mailing could not be created, for example the bot has no database. Retry later |
Was this article helpful?
Didn't find the answer? Contact support