Views: 2439
Last Modified: 09.02.2022

Uses bot command

Revision Get current information about current API revision (platform version) – im.revision.get : 30

Parameters

Parameter Example Required Description Revision
MESSAGE_ID 278 Yes Message ID with option to send a bot command 30
BOT_ID 1 Yes Bot ID in chat 30
COMMAND 'KEYBOARD' Yes Command to be executed by bot 30
COMMAND_PARAMS 'stop' Yes Command parameters 30

Pass the message with selection of bot commands.


Called method and response

JavaScript

B24.callMethod(
  'im.message.command',
  {
    MESSAGE_ID: 278,
    BOT_ID: 1,
    COMMAND: 'KEYBOARD',
    COMMAND_PARAMS: 'stop'
  },
  res => {
    if (res.error())
    {
      console.error(result.error().ex);
    }
    else
    {
      console.log(res.data())
    }
  }
)

Response example

true

Example of response on error

{
  "error":"PARAMS_ERROR",
  "error_description":"Incorrect params"
}

Key description:

  • error – error code
  • error_description – error brief description

Possible error codes

Code Description
MESSAGE_ID_ERROR Parameter MESSAGE_ID not specified or isn't an integer
BOT_ID_ERROR Parameter BOT_ID not specified or isn't an integer
COMMAND_ERROR Parameter COMMAND not specified
PARAMS_ERROR Parameter COMMAND_PARAMS not specified or doesn't match the bot parameter command




Courses developed by Bitrix24