Bitrix API

SupportBot extends NetworkBot

Common interface for support bots.

Table of Contents

Methods

allowAdditionalQuestion()  : bool
Permits adding new question.
getAccessLevel()  : string
Detects client's access level.
getAppList()  : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
Returns app's property list.
getBotAvatar()  : string
Returns url of the bot avatar picture.
getBotCode()  : string
Returns OL code.
getBotDesc()  : string
Return bot shot description.
getBotId()  : int
Returns registered bot Id.
getBotName()  : string
Return name of the bot.
getBotSettings()  : array<string|int, mixed>|null
Loads bot settings from controller.
getCommandList()  : array<string|int, array{handler: string, visible: bool, context: string}>
Returns command's property list.
getError()  : Error
getMessage()  : string|null
Returns phrase by the code.
getQuestionLimit()  : int
Returns the limit for additional questions.
getSupportLevel()  : string
Detects client's support level.
isEnabled()  : bool
Is bot enabled.
isNeedUpdateBotAvatarAfterNewMessage()  : bool
Allows updating bot's avatar using data from incoming message.
isNeedUpdateBotFieldsAfterNewMessage()  : bool
Allows updating bot fields (name, desc, avatar, welcome mess) using data from incoming message.
onAnswerAdd()  : array<string|int, mixed>
Event handler on answer add.
onBotDelete()  : bool
Event handler on bot remove.
onChatStart()  : bool
Event handler when bot join to chat.
onCommandAdd()  : bool
Event handler on command add.
onMessageAdd()  : bool
Event handler on message add.
onReceiveCommand()  : Error|array<string|int, mixed>
Event handler on answer add.
onSessionVote()  : bool
Handler for "im:OnSessionVote" event.
register()  : int
Register bot at portal.
registerApps()  : bool
Register bot's command.
registerCommands()  : bool
Register bot's command.
unRegister()  : bool
Unregister bot at portal.

Methods

allowAdditionalQuestion()

Permits adding new question.

public static allowAdditionalQuestion([int|null $botId = null ]) : bool
Parameters
$botId : int|null = null
Return values
bool

getAccessLevel()

Detects client's access level.

public static getAccessLevel() : string
Return values
string

getAppList()

Returns app's property list.

public static getAppList() : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
Return values
array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>

getBotAvatar()

Returns url of the bot avatar picture.

public static getBotAvatar() : string
Return values
string

getBotCode()

Returns OL code.

public static getBotCode() : string
Return values
string

getBotDesc()

Return bot shot description.

public static getBotDesc() : string
Return values
string

getBotId()

Returns registered bot Id.

public static getBotId() : int
Return values
int

getBotName()

Return name of the bot.

public static getBotName() : string
Return values
string

getBotSettings()

Loads bot settings from controller.

public static getBotSettings([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|null
Parameters
$params : array<string|int, mixed> = []

Command arguments.

Return values
array<string|int, mixed>|null

getCommandList()

Returns command's property list.

public static getCommandList() : array<string|int, array{handler: string, visible: bool, context: string}>
Return values
array<string|int, array{handler: string, visible: bool, context: string}>

getError()

public static getError() : Error
Return values
Error

getMessage()

Returns phrase by the code.

public static getMessage(string $code) : string|null
Parameters
$code : string
Return values
string|null

getQuestionLimit()

Returns the limit for additional questions.

public static getQuestionLimit([int|null $botId = null ]) : int
Parameters
$botId : int|null = null
Return values
int

-1 - Functional is disabled, 0 - There is no limit, 1 - Only one session allowed, n - Max number for sessions allowed.

getSupportLevel()

Detects client's support level.

public static getSupportLevel() : string
Return values
string

isEnabled()

Is bot enabled.

public static isEnabled() : bool
Return values
bool

isNeedUpdateBotAvatarAfterNewMessage()

Allows updating bot's avatar using data from incoming message.

public static isNeedUpdateBotAvatarAfterNewMessage() : bool
Return values
bool

isNeedUpdateBotFieldsAfterNewMessage()

Allows updating bot fields (name, desc, avatar, welcome mess) using data from incoming message.

public static isNeedUpdateBotFieldsAfterNewMessage() : bool
Return values
bool

onAnswerAdd()

Event handler on answer add.

public static onAnswerAdd(string $command, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$command : string
$params : array<string|int, mixed>
Tags
see
Controller::sendToBot
Return values
array<string|int, mixed>

onBotDelete()

Event handler on bot remove.

public static onBotDelete([int|null $bodId = null ]) : bool
Parameters
$bodId : int|null = null
Tags
see
Bot::unRegister

Method registers at bot field b_im_bot.METHOD_BOT_DELETE

Return values
bool

onChatStart()

Event handler when bot join to chat.

public static onChatStart(string $dialogId, array<string|int, mixed> $joinFields) : bool
Parameters
$dialogId : string
$joinFields : array<string|int, mixed>
Tags
see
Bot::onJoinChat

Method registers at bot field b_im_bot.METHOD_WELCOME_MESSAGE

Return values
bool

onCommandAdd()

Event handler on command add.

public static onCommandAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
$messageId : int

Incomming message Id.

$messageFields : array<string|int, mixed>

Message fields array.

Tags
see
Command::onCommandAdd

Method registers at bot field b_im_command.METHOD_COMMAND_ADD

Return values
bool

onMessageAdd()

Event handler on message add.

public static onMessageAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
$messageId : int

Outgoing message Id.

$messageFields : array<string|int, mixed>

Message fields array.

Tags
see
Bot::onMessageAdd

Method registers at bot field b_im_bot.METHOD_MESSAGE_ADD

Return values
bool

onReceiveCommand()

Event handler on answer add.

public static onReceiveCommand(string $command, array<string|int, mixed> $params) : Error|array<string|int, mixed>

Alias for @see \Bitrix\Imbot\Bot\ChatBot::onAnswerAdd

Parameters
$command : string

Text command alias.

$params : array<string|int, mixed>

Command arguments.

Return values
Error|array<string|int, mixed>

onSessionVote()

Handler for "im:OnSessionVote" event.

public static onSessionVote(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>

Event arguments.

Tags
see
Event::onSessionVote
Return values
bool

register()

Register bot at portal.

public static register([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

registerApps()

Register bot's command.

public static registerApps() : bool
Return values
bool

registerCommands()

Register bot's command.

public static registerCommands() : bool
Return values
bool

unRegister()

Unregister bot at portal.

public static unRegister([string $code = '' ][, bool $notifyController = true ]) : bool
Parameters
$code : string = ''

Open Line Id.

$notifyController : bool = true

Send unregister notification request to controller.

Return values
bool

        
On this page

Search results