* Validation error text may vary depending on a source of an error
Description
This method is for sending common messages from service (bot) to a dialog with a user, group dialog or a channel.
If a service specify value of localID variable, it would get MessageIdAssigned with localId - messageId match update asynchroniously.
If you set media and inline buttons concurrently in one message client won't display inline buttons, as this an issue for future development.
On succes empty response with http code 200 is returned.
Endpoint
https://messapi.btsdapps.net/bot/v1/updates/
Structure
Variable | Obligative | Type | Validation | Description |
---|---|---|---|---|
type | true | String | Must be filled with “SendMessage” value | Type of request “SendMessage” |
localId | false | String | LocalID length should be <= 255 | Message ID generated by Bot |
content | true | String | Content length should be <= 4096 | Text of a message |
recipient | true | Peer | For Peer type validation see type page | Peer to send this message to |
replyToMessageId | false | String | Content length should be <= 4096 | Message ID to reply to |
inlineCommands | false | List of InlineCommand | Number of inlineCommands should be <= 8, recommended number is 3. For inlineCommand type validation see type page | List of InlineCommands (list of buttons that will be displayed on Messenger UI inside the message). Currently this is deprecated, use inlineCommandRows |
inlineCommandRows | false | List of InlineCommand lists | Table should not have more than 25 rows, 25 columns | List containing lists of InlineCommands (Table of buttons that will be displayed on Messenger UI inside the message) |
uiState | false | UiState | For uiState type validation see type page | Bot Ui State buttons |
mediaList | false | List of InputMedia | mediaList size should be <= 100 | List of InputMedia. Media content to be showed in a message |
silentMode | false | Boolean | - | Flag indicating is there need to send message in silent mode |
Sample request
"commands":[
{
"type":"SendMessage",
"localId":"12345",
"content":"Hello",
"recipient":{
"type":"USER",
"id":"Uuid_value"
}
}
]
Updates
This method may asynchronously return following updates:
Possible business exceptions
Service to service dialog
Sending messages from service to service is not available, function is not supported.
Service to user dialog
- Sending a message to a user who banned a service ( put a service into a black list) is not available;
- Sending a message to a user is not available if a dialog wasn't found (deleted/ID error);
- Sending a message to a user is not available if Peer type and Peer ID specified in request doesn't match;
Service to channel dialog
- Sending a message to a channel is not available if a channel wasn't found (deleted/ID error) or channel was banned;
- Sending a message to a channel is not available if a service is not a channel subscriber and has no administrator/owner role assigned;
Service to group dialog
Sending a message to a group dialog is not available if a service is not a member of this group.