Skip to content

setMyCommands

Set the Bot's command list. Users will see these commands when they type / in the input field.

Request

POST /:token/setmycommands

Parameters

ParameterTypeRequiredDescription
commandsBotCommand[]YesArray of BotCommand objects, each containing a command and description field
scopeBotCommandScopeNoScope of the commands, defaults to all chats
language_codeStringNoIETF language code for specifying a language-specific command list

BotCommand Object

FieldTypeDescription
commandStringCommand text, 1-32 characters, containing only lowercase letters, digits, and underscores
descriptionStringCommand description, 1-256 characters

Response

Returns Boolean true on success.

json
{
  "ok": true,
  "result": true
}

Request Example

json
{
  "commands": [
    {
      "command": "start",
      "description": "Start the bot"
    },
    {
      "command": "help",
      "description": "Get help information"
    },
    {
      "command": "settings",
      "description": "Change settings"
    }
  ]
}

Error Codes

CodeDescription
400Bad request parameters, e.g. invalid commands format or command contains illegal characters
401Invalid or expired token
500Internal server error