Partner24 extends Network implements SupportBot
Table of Contents
Interfaces
- SupportBot
Constants
- BOT_CODE = 'partner24'
- BUTTON_DEFAULT_COLOR = '#29619b'
- BUTTON_DISABLED_COLOR = '#aaa'
- CHAT_ENTITY_TYPE = 'NETWORK_DIALOG'
- CHAT_NETWORK_SUPPORT_COUNTER = 'imbot_network_dialog_'
- CHAT_NETWORK_SUPPORT_MAX_DIALOGS_OPTION = 'network_dialogs_max_count_'
- COMMAND_CHECK_PUBLIC_URL = 'checkPublicUrl'
- COMMAND_CONNECTOR_REGISTER = 'RegisterConnector'
- COMMAND_CONNECTOR_UNREGISTER = 'UnRegisterConnector'
- COMMAND_CONNECTOR_UPDATE = 'UpdateConnector'
- COMMAND_FINISH_DIALOG_SESSION = 'finishDialogSession'
- COMMAND_NETWORK_SESSION = 'session'
- COMMAND_OPERATOR_CHANGE_LINE = 'operatorChangeLine'
- COMMAND_OPERATOR_MESSAGE_ADD = 'operatorMessageAdd'
- COMMAND_OPERATOR_MESSAGE_DELETE = 'operatorMessageDelete'
- COMMAND_OPERATOR_MESSAGE_RECEIVED = 'operatorMessageReceived'
- COMMAND_OPERATOR_MESSAGE_UPDATE = 'operatorMessageUpdate'
- COMMAND_OPERATOR_OPEN_NEW_DIALOG = 'operatorOpenNewDialog'
- COMMAND_OPERATOR_START_WRITING = 'operatorStartWriting'
- COMMAND_START_DIALOG_SESSION = 'startDialogSession'
- COMMAND_UNREGISTER = 'unregister'
- MESSAGE_PARAM_ALLOW_QUOTE = 'IMOL_QUOTE_MSG'
- MESSAGE_PARAM_ATTACH = 'ATTACH'
- MESSAGE_PARAM_CONNECTOR_MID = 'CONNECTOR_MID'
- MESSAGE_PARAM_DELIVERED = 'IS_DELIVERED'
- MESSAGE_PARAM_IMOL_VOTE = 'IMOL_VOTE'
- MESSAGE_PARAM_IMOL_VOTE_DISLIKE = 'IMOL_VOTE_DISLIKE'
- MESSAGE_PARAM_IMOL_VOTE_LIKE = 'IMOL_VOTE_LIKE'
- MESSAGE_PARAM_KEYBOARD = 'KEYBOARD'
- MESSAGE_PARAM_SENDING = 'SENDING'
- MESSAGE_PARAM_SENDING_TIME = 'SENDING_TS'
- MESSAGE_PARAM_SESSION_ID = 'IMOL_SID'
- MODULE_ID = "imbot"
- MULTIDIALOG_STATUS_CLOSE = 'CLOSE'
- MULTIDIALOG_STATUS_NEW = 'NEW'
- MULTIDIALOG_STATUS_OPEN = 'OPEN'
- OPTION_BOT_ACTIVE = 'partner24_active'
- OPTION_BOT_AVATAR = 'partner24_avatar'
- OPTION_BOT_DESC = 'partner24_desc'
- OPTION_BOT_FOR_ALL = 'partner24_for_all'
- OPTION_BOT_ID = 'partner24_bot_id'
- OPTION_BOT_MESSAGES = 'partner24_messages'
- OPTION_BOT_NAME = 'partner24_name'
- OPTION_BOT_REGULAR_SUPPORT = 'partner24_regular_support'
- OPTION_BOT_SUPPORT_CODE = 'partner24_support_code'
- OPTION_BOT_SUPPORT_NAME = 'partner24_support_name'
- OPTION_BOT_WAIT_ACTIVATION = 'partner24_wait_activation'
- PORTAL_PATH = '/pub/imbot.php'
- REGULAR_SUPPORT_INTEGRATOR = 'PARTNER24_REGULAR_INTEGRATOR'
- REGULAR_SUPPORT_NONE = 'PARTNER24_REGULAR_NO'
- SUPPORT_LEVEL_FREE = 'free'
- SUPPORT_LEVEL_NONE = 'none'
- SUPPORT_LEVEL_PAID = 'paid'
- SUPPORT_LEVEL_PARTNER = 'partner'
Methods
- acceptRequest() : bool
- Activate partner support on portal.
- activate() : bool
- Activate partner support on portal for certain user.
- addAgent() : bool
- Adds agent.
- addError() : void
- addNetworkQuestionByBotId() : int
- allowAdditionalQuestion() : bool
- allowIntegratorAccessAlongSupport24() : bool
- Checks if integrator has access to partner OL along with regular support active.
- change() : bool
- checkCodeBlacklist() : bool
- checkPublicUrl() : bool
- Checks availability of the external public url.
- checkSessionVoteMessage() : bool
- Performs checking if it is user voting for session by direct text input '1' or '0'.
- cleanQuestionsCountCache() : void
- clientMessageAdd() : bool|array<string|int, mixed>
- Sends new client message into network line.
- deactivate() : bool
- declineRequest() : bool
- delayShowingMessage() : bool
- deleteAgent() : bool
- Removes agents.
- deleteScheduledAction() : void
- finishDialogSession() : mixed
- getAccessLevel() : string
- Detects client's support level.
- getAdministrators() : array<string|int, int>
- List of administrator users.
- getAllQuestions() : array<string|int, mixed>
- getAppList() : array<string|int, array{command: string, icon: string, js: string, context: string, lang: string}>
- Returns app's property list.
- getBotAsMultidialog() : mixed
- getBotAvatar() : string
- getBotCode() : string
- Returns OL code.
- getBotDesc() : string
- getBotId() : int
- Returns registered bot Id.
- getBotName() : string
- getBotSettings() : array<string|int, mixed>|null
- Loads bot settings from controller.
- getBusinessUsers() : array<string|int, int>
- List of unlimited users.
- getChatWithBot() : array<string|int, mixed>|null
- getCommandList() : array<string|int, array{class: string, handler: string, visible: bool, context: string}>
- Returns command's property list.
- getError() : Error
- getEventHandlerList() : array<string|int, array{module: string, event: string, class: string, handler: string}>
- Returns event handler list.
- getLangMessage() : string
- Returns phrase according its code.
- getLicenceLanguage() : string
- Detects client's support level.
- getMessage() : string
- getMultidialog() : array<string|int, mixed>|null
- getNetworkBotId() : bool|int
- Returns open line bot id.
- getPartnerName() : string
- getQuestionLimit() : int
- Returns the limit for additional questions.
- getQuestionList() : array<string|int, mixed>
- getQuestionsCount() : int
- getQuestionsWithUnreadMessages() : array<string|int, mixed>
- getRecentDialogs() : Generator|iterable<string|int, mixed>
- Returns bot's recent dialogs.
- getSupportLevel() : string
- getUserGeoData() : string
- Collects some available geo data.
- hasError() : bool
- Tells true if error has occurred.
- incrementGlobalDialogCounter() : int
- initHttpClient() : Http
- Replace web client.
- isActiveSupport() : bool
- isActiveSupportForAll() : bool
- Allows everyone writes to OL.
- isActiveSupportForUser() : bool
- Allows certain user write to OL.
- isEnabled() : bool
- Is bot enabled.
- isFdcCode() : bool
- 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.
- isUserAdmin() : bool
- Checks if user has an portal administrator access role.
- isUserIntegrator() : bool
- Checks if user has an integrator access role.
- isWaitingActivation() : bool
- join() : bool|int
- Check if network bot exists and registers it.
- onAfterSupportCodeChange() : bool
- onAnswerAdd() : array<string|int, mixed>|Error
- 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.
- onCommandLang() : bool|array<string|int, mixed>
- Returns title and description for app or command list.
- onLocalCommandAdd() : mixed
- Compatibility alias to the onCommandAdd method.
- onMessageAdd() : bool
- Event handler on message add.
- onMessageDelete() : bool
- onMessageUpdate() : bool
- onReceiveCommand() : Error|array<string|int, mixed>
- Event handler on answer add.
- onSessionVote() : bool
- Handler for "im:OnSessionVote" event.
- onStartWriting() : bool
- onWelcomeMessage() : mixed
- Compatibility alias to the onChatStart method.
- register() : bool|int
- Register bot at portal.
- registerApps() : bool
- Register bot's command.
- registerCommands() : bool
- Register bot's command.
- registerConnector() : array<string|int, mixed>|bool
- replacePlaceholders() : string
- Replaces standard placeholders.
- scheduleAction() : void
- scheduledActionAgent() : string
- search() : bool|array<string|int, mixed>
- Looks for the network openline.
- sendMessage() : array<string|int, mixed>
- Sends message to client.
- sendNotifyChangeLicence() : bool
- Sends notify change licence.
- sendRequest() : bool
- sendRequestFinalizeSession() : bool
- Sends finalize session notification.
- sendUnregisterRequest() : bool
- Sends unregister bot request.
- setBotId() : bool
- Saves new Id of the registered bot.
- setNetworkBotId() : bool
- Saves new open line bot id.
- setOptions() : bool
- setQuestionLimit() : void
- Returns the limit for additional questions.
- unRegister() : bool
- Unregister bot at portal.
- unRegisterConnector() : bool|array<string|int, mixed>
- updateBotProperties() : bool
- updateConnector() : bool|array<string|int, mixed>
- uploadAvatar() : array<string|int, mixed>|string
- Dowlloads user avatar via supplied image url.
- uploadIcon() : bool|int
Constants
BOT_CODE
public
mixed
BOT_CODE
= 'partner24'
BUTTON_DEFAULT_COLOR
public
mixed
BUTTON_DEFAULT_COLOR
= '#29619b'
BUTTON_DISABLED_COLOR
public
mixed
BUTTON_DISABLED_COLOR
= '#aaa'
CHAT_ENTITY_TYPE
public
mixed
CHAT_ENTITY_TYPE
= 'NETWORK_DIALOG'
CHAT_NETWORK_SUPPORT_COUNTER
public
mixed
CHAT_NETWORK_SUPPORT_COUNTER
= 'imbot_network_dialog_'
CHAT_NETWORK_SUPPORT_MAX_DIALOGS_OPTION
public
mixed
CHAT_NETWORK_SUPPORT_MAX_DIALOGS_OPTION
= 'network_dialogs_max_count_'
COMMAND_CHECK_PUBLIC_URL
public
mixed
COMMAND_CHECK_PUBLIC_URL
= 'checkPublicUrl'
COMMAND_CONNECTOR_REGISTER
public
mixed
COMMAND_CONNECTOR_REGISTER
= 'RegisterConnector'
COMMAND_CONNECTOR_UNREGISTER
public
mixed
COMMAND_CONNECTOR_UNREGISTER
= 'UnRegisterConnector'
COMMAND_CONNECTOR_UPDATE
public
mixed
COMMAND_CONNECTOR_UPDATE
= 'UpdateConnector'
COMMAND_FINISH_DIALOG_SESSION
public
mixed
COMMAND_FINISH_DIALOG_SESSION
= 'finishDialogSession'
COMMAND_NETWORK_SESSION
public
mixed
COMMAND_NETWORK_SESSION
= 'session'
COMMAND_OPERATOR_CHANGE_LINE
public
mixed
COMMAND_OPERATOR_CHANGE_LINE
= 'operatorChangeLine'
COMMAND_OPERATOR_MESSAGE_ADD
public
mixed
COMMAND_OPERATOR_MESSAGE_ADD
= 'operatorMessageAdd'
COMMAND_OPERATOR_MESSAGE_DELETE
public
mixed
COMMAND_OPERATOR_MESSAGE_DELETE
= 'operatorMessageDelete'
COMMAND_OPERATOR_MESSAGE_RECEIVED
public
mixed
COMMAND_OPERATOR_MESSAGE_RECEIVED
= 'operatorMessageReceived'
COMMAND_OPERATOR_MESSAGE_UPDATE
public
mixed
COMMAND_OPERATOR_MESSAGE_UPDATE
= 'operatorMessageUpdate'
COMMAND_OPERATOR_OPEN_NEW_DIALOG
public
mixed
COMMAND_OPERATOR_OPEN_NEW_DIALOG
= 'operatorOpenNewDialog'
COMMAND_OPERATOR_START_WRITING
public
mixed
COMMAND_OPERATOR_START_WRITING
= 'operatorStartWriting'
COMMAND_START_DIALOG_SESSION
public
mixed
COMMAND_START_DIALOG_SESSION
= 'startDialogSession'
COMMAND_UNREGISTER
public
mixed
COMMAND_UNREGISTER
= 'unregister'
MESSAGE_PARAM_ALLOW_QUOTE
public
mixed
MESSAGE_PARAM_ALLOW_QUOTE
= 'IMOL_QUOTE_MSG'
MESSAGE_PARAM_ATTACH
public
mixed
MESSAGE_PARAM_ATTACH
= 'ATTACH'
MESSAGE_PARAM_CONNECTOR_MID
public
mixed
MESSAGE_PARAM_CONNECTOR_MID
= 'CONNECTOR_MID'
MESSAGE_PARAM_DELIVERED
public
mixed
MESSAGE_PARAM_DELIVERED
= 'IS_DELIVERED'
MESSAGE_PARAM_IMOL_VOTE
public
mixed
MESSAGE_PARAM_IMOL_VOTE
= 'IMOL_VOTE'
MESSAGE_PARAM_IMOL_VOTE_DISLIKE
public
mixed
MESSAGE_PARAM_IMOL_VOTE_DISLIKE
= 'IMOL_VOTE_DISLIKE'
MESSAGE_PARAM_IMOL_VOTE_LIKE
public
mixed
MESSAGE_PARAM_IMOL_VOTE_LIKE
= 'IMOL_VOTE_LIKE'
MESSAGE_PARAM_KEYBOARD
public
mixed
MESSAGE_PARAM_KEYBOARD
= 'KEYBOARD'
MESSAGE_PARAM_SENDING
public
mixed
MESSAGE_PARAM_SENDING
= 'SENDING'
MESSAGE_PARAM_SENDING_TIME
public
mixed
MESSAGE_PARAM_SENDING_TIME
= 'SENDING_TS'
MESSAGE_PARAM_SESSION_ID
public
mixed
MESSAGE_PARAM_SESSION_ID
= 'IMOL_SID'
MODULE_ID
public
mixed
MODULE_ID
= "imbot"
MULTIDIALOG_STATUS_CLOSE
public
mixed
MULTIDIALOG_STATUS_CLOSE
= 'CLOSE'
MULTIDIALOG_STATUS_NEW
public
mixed
MULTIDIALOG_STATUS_NEW
= 'NEW'
MULTIDIALOG_STATUS_OPEN
public
mixed
MULTIDIALOG_STATUS_OPEN
= 'OPEN'
OPTION_BOT_ACTIVE
public
mixed
OPTION_BOT_ACTIVE
= 'partner24_active'
OPTION_BOT_AVATAR
public
mixed
OPTION_BOT_AVATAR
= 'partner24_avatar'
OPTION_BOT_DESC
public
mixed
OPTION_BOT_DESC
= 'partner24_desc'
OPTION_BOT_FOR_ALL
public
mixed
OPTION_BOT_FOR_ALL
= 'partner24_for_all'
OPTION_BOT_ID
public
mixed
OPTION_BOT_ID
= 'partner24_bot_id'
OPTION_BOT_MESSAGES
public
mixed
OPTION_BOT_MESSAGES
= 'partner24_messages'
OPTION_BOT_NAME
public
mixed
OPTION_BOT_NAME
= 'partner24_name'
OPTION_BOT_REGULAR_SUPPORT
public
mixed
OPTION_BOT_REGULAR_SUPPORT
= 'partner24_regular_support'
OPTION_BOT_SUPPORT_CODE
public
mixed
OPTION_BOT_SUPPORT_CODE
= 'partner24_support_code'
OPTION_BOT_SUPPORT_NAME
public
mixed
OPTION_BOT_SUPPORT_NAME
= 'partner24_support_name'
OPTION_BOT_WAIT_ACTIVATION
public
mixed
OPTION_BOT_WAIT_ACTIVATION
= 'partner24_wait_activation'
PORTAL_PATH
public
mixed
PORTAL_PATH
= '/pub/imbot.php'
REGULAR_SUPPORT_INTEGRATOR
public
mixed
REGULAR_SUPPORT_INTEGRATOR
= 'PARTNER24_REGULAR_INTEGRATOR'
REGULAR_SUPPORT_NONE
public
mixed
REGULAR_SUPPORT_NONE
= 'PARTNER24_REGULAR_NO'
SUPPORT_LEVEL_FREE
public
mixed
SUPPORT_LEVEL_FREE
= 'free'
SUPPORT_LEVEL_NONE
public
mixed
SUPPORT_LEVEL_NONE
= 'none'
SUPPORT_LEVEL_PAID
public
mixed
SUPPORT_LEVEL_PAID
= 'paid'
SUPPORT_LEVEL_PARTNER
public
mixed
SUPPORT_LEVEL_PARTNER
= 'partner'
Methods
acceptRequest()
Activate partner support on portal.
public
static acceptRequest(int $userId) : bool
Parameters
- $userId : int
Return values
boolactivate()
Activate partner support on portal for certain user.
public
static activate(int $userId, string $supportCode[, string|null $supportName = null ]) : bool
Parameters
- $userId : int
- $supportCode : string
- $supportName : string|null = null
Return values
booladdAgent()
Adds agent.
public
static addAgent(array{agent: string, class: string, next_execution: string, delay: int, regular: bool, interval: int} $params) : bool
Parameters
- $params : array{agent: string, class: string, next_execution: string, delay: int, regular: bool, interval: int}
Tags
Return values
booladdError()
public
static addError(Error $error) : void
Parameters
- $error : Error
addNetworkQuestionByBotId()
public
static addNetworkQuestionByBotId(int $botId[, int|null $userId = null ]) : int
Parameters
- $botId : int
- $userId : int|null = null
Return values
intallowAdditionalQuestion()
public
static allowAdditionalQuestion([int|null $botId = null ]) : bool
Parameters
- $botId : int|null = null
Return values
boolallowIntegratorAccessAlongSupport24()
Checks if integrator has access to partner OL along with regular support active.
public
static allowIntegratorAccessAlongSupport24() : bool
Return values
boolchange()
public
static change(int $userId, string $supportCode[, string|null $supportName = null ]) : bool
Parameters
- $userId : int
- $supportCode : string
- $supportName : string|null = null
Return values
boolcheckCodeBlacklist()
public
static checkCodeBlacklist(string $code) : bool
Parameters
- $code : string
Return values
boolcheckPublicUrl()
Checks availability of the external public url.
public
static checkPublicUrl([string $publicUrl = null ]) : bool
Parameters
- $publicUrl : string = null
-
Portal public url.
Tags
Return values
boolcheckSessionVoteMessage()
Performs checking if it is user voting for session by direct text input '1' or '0'.
public
static checkSessionVoteMessage(array<string|int, mixed> $messageFields) : bool
Parameters
- $messageFields : array<string|int, mixed>
-
Message arguments.
Return values
boolcleanQuestionsCountCache()
public
static cleanQuestionsCountCache([int|null $botId = null ]) : void
Parameters
- $botId : int|null = null
clientMessageAdd()
Sends new client message into network line.
public
static clientMessageAdd(array<string|int, mixed> $fields) : bool|array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed>
-
Command arguments.
[ (int) USER_ID (int|string) DIALOG_ID (string|array) MESSAGE (int) BOT_ID (array) FILES (array) ATTACH (array) PARAMS ]
Tags
Return values
bool|array<string|int, mixed>deactivate()
public
static deactivate(int $userId) : bool
Parameters
- $userId : int
Return values
booldeclineRequest()
public
static declineRequest(int $userId) : bool
Parameters
- $userId : int
Return values
booldelayShowingMessage()
public
static delayShowingMessage(mixed $botId, array<string|int, mixed> $messageFields) : bool
Parameters
- $botId : mixed
- $messageFields : array<string|int, mixed>
Return values
booldeleteAgent()
Removes agents.
public
static deleteAgent(array{agent: string, mask: string, class: string} $params) : bool
Parameters
- $params : array{agent: string, mask: string, class: string}
Tags
Return values
booldeleteScheduledAction()
public
static deleteScheduledAction([string $target = '' ][, string $action = '' ][, string $code = '' ]) : void
Parameters
- $target : string = ''
- $action : string = ''
- $code : string = ''
finishDialogSession()
public
static finishDialogSession(mixed $params) : mixed
Parameters
- $params : mixed
Tags
getAccessLevel()
Detects client's support level.
public
static getAccessLevel() : string
Return values
stringgetAdministrators()
List of administrator users.
public
static getAdministrators() : array<string|int, int>
Return values
array<string|int, int>getAllQuestions()
public
static getAllQuestions([int|null $botId = null ][, int|null $userId = null ]) : array<string|int, mixed>
Parameters
- $botId : int|null = null
- $userId : int|null = null
Return values
array<string|int, mixed>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}>getBotAsMultidialog()
public
static getBotAsMultidialog(int $botId, int $userId) : mixed
Parameters
- $botId : int
- $userId : int
getBotAvatar()
public
static getBotAvatar() : string
Return values
stringgetBotCode()
Returns OL code.
public
static getBotCode() : string
Return values
stringgetBotDesc()
public
static getBotDesc() : string
Return values
stringgetBotId()
Returns registered bot Id.
public
static getBotId() : int
Return values
intgetBotName()
public
static getBotName() : string
Return values
stringgetBotSettings()
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.
[ (int) BOT_ID ]
Return values
array<string|int, mixed>|nullgetBusinessUsers()
List of unlimited users.
public
static getBusinessUsers() : array<string|int, int>
Tags
Return values
array<string|int, int>getChatWithBot()
public
static getChatWithBot([int|null $botId = null ][, int|null $userId = null ]) : array<string|int, mixed>|null
Parameters
- $botId : int|null = null
- $userId : int|null = null
Return values
array<string|int, mixed>|nullgetCommandList()
Returns command's property list.
public
static getCommandList() : array<string|int, array{class: string, handler: string, visible: bool, context: string}>
Return values
array<string|int, array{class: string, handler: string, visible: bool, context: string}>getError()
public
static getError() : Error
Return values
ErrorgetEventHandlerList()
Returns event handler list.
public
static getEventHandlerList() : array<string|int, array{module: string, event: string, class: string, handler: string}>
Return values
array<string|int, array{module: string, event: string, class: string, handler: string}>getLangMessage()
Returns phrase according its code.
public
static getLangMessage([string $messageCode = '' ]) : string
Parameters
- $messageCode : string = ''
-
Phrase code.
Return values
stringgetLicenceLanguage()
Detects client's support level.
public
static getLicenceLanguage() : string
Return values
stringgetMessage()
public
static getMessage(string $code) : string
Parameters
- $code : string
Return values
stringgetMultidialog()
public
static getMultidialog(int $chatId[, int|null $botId = null ][, int|null $userId = null ]) : array<string|int, mixed>|null
Parameters
- $chatId : int
- $botId : int|null = null
- $userId : int|null = null
Return values
array<string|int, mixed>|nullgetNetworkBotId()
Returns open line bot id.
public
static getNetworkBotId(string $code[, bool $getFromDb = false ]) : bool|int
Parameters
- $code : string
-
Line code.
- $getFromDb : bool = false
-
Do not use Main\Config\Option to detect it.
Return values
bool|intgetPartnerName()
public
static getPartnerName() : string
Return values
stringgetQuestionLimit()
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, n - Max number for sessions allowed.
getQuestionList()
public
static getQuestionList(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>getQuestionsCount()
public
static getQuestionsCount([int|null $botId = null ][, int|null $userId = null ]) : int
Parameters
- $botId : int|null = null
- $userId : int|null = null
Return values
intgetQuestionsWithUnreadMessages()
public
static getQuestionsWithUnreadMessages([int|null $botId = null ]) : array<string|int, mixed>
Parameters
- $botId : int|null = null
Return values
array<string|int, mixed>getRecentDialogs()
Returns bot's recent dialogs.
public
static getRecentDialogs([int $hoursDepth = 168 ][, int|null $botId = null ]) : Generator|iterable<string|int, mixed>
Parameters
- $hoursDepth : int = 168
-
Depth into past. Default: 7 days.
- $botId : int|null = null
Return values
Generator|iterable<string|int, mixed> —[ 0 => [ (int) USER_ID (int) CHAT_ID (string) RECENTLY_TALK (int) MESSAGE_ID ], ...
getSupportLevel()
public
static getSupportLevel() : string
Return values
stringgetUserGeoData()
Collects some available geo data.
public
static getUserGeoData() : string
Return values
stringhasError()
Tells true if error has occurred.
public
static hasError() : bool
Return values
boolincrementGlobalDialogCounter()
public
static incrementGlobalDialogCounter(int $botId) : int
Parameters
- $botId : int
Return values
intinitHttpClient()
Replace web client.
public
static initHttpClient(Http $httpClient) : Http
Parameters
- $httpClient : Http
Return values
HttpisActiveSupport()
public
static isActiveSupport() : bool
Return values
boolisActiveSupportForAll()
Allows everyone writes to OL.
public
static isActiveSupportForAll() : bool
Return values
boolisActiveSupportForUser()
Allows certain user write to OL.
public
static isActiveSupportForUser(int $userId) : bool
Parameters
- $userId : int
Return values
boolisEnabled()
Is bot enabled.
public
static isEnabled() : bool
Return values
boolisFdcCode()
public
static isFdcCode(string $text) : bool
Parameters
- $text : string
Return values
boolisNeedUpdateBotAvatarAfterNewMessage()
Allows updating bot's avatar using data from incoming message.
public
static isNeedUpdateBotAvatarAfterNewMessage() : bool
Tags
Return values
boolisNeedUpdateBotFieldsAfterNewMessage()
Allows updating bot fields (name, desc, avatar, welcome mess) using data from incoming message.
public
static isNeedUpdateBotFieldsAfterNewMessage() : bool
Tags
Return values
boolisUserAdmin()
Checks if user has an portal administrator access role.
public
static isUserAdmin(int $userId) : bool
Parameters
- $userId : int
Return values
boolisUserIntegrator()
Checks if user has an integrator access role.
public
static isUserIntegrator(int $userId) : bool
Parameters
- $userId : int
Return values
boolisWaitingActivation()
public
static isWaitingActivation() : bool
Return values
booljoin()
Check if network bot exists and registers it.
public
static join(string $code[, array<string|int, mixed> $options = [] ]) : bool|int
Parameters
- $code : string
-
Open line code.
- $options : array<string|int, mixed> = []
-
Additional bot user parameters.
Return values
bool|intonAfterSupportCodeChange()
public
static onAfterSupportCodeChange([string $currentCode = '' ][, string $previousCode = '' ]) : bool
Parameters
- $currentCode : string = ''
- $previousCode : string = ''
Return values
boolonAnswerAdd()
Event handler on answer add.
public
static onAnswerAdd(string $command, array<string|int, mixed> $params) : array<string|int, mixed>|Error
Parameters
- $command : string
-
Text command alias.
- $params : array<string|int, mixed>
-
Command arguments.
Return values
array<string|int, mixed>|ErroronBotDelete()
Event handler on bot remove.
public
static onBotDelete([int|null $bodId = null ]) : bool
Parameters
- $bodId : int|null = null
Return values
boolonChatStart()
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
Return values
boolonCommandAdd()
Event handler on command add.
public
static onCommandAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Message Id.
- $messageFields : array<string|int, mixed>
-
Event arguments.
[ (string) COMMAND (string) COMMAND_PARAMS (string) COMMAND_CONTEXT == KEYBOARD (int) COMMAND_ID (string) MESSAGE_TYPE == P (string) SYSTEM != Y (int) TO_USER_ID (int) FROM_USER_ID (int) CONNECTOR_MID ]
Return values
boolonCommandLang()
Returns title and description for app or command list.
public
static onCommandLang(string $command[, string $lang = null ]) : bool|array<string|int, mixed>
Parameters
- $command : string
-
App or command code.
- $lang : string = null
-
Language Id.
Return values
bool|array<string|int, mixed>onLocalCommandAdd()
Compatibility alias to the onCommandAdd method.
public
static onLocalCommandAdd(mixed $messageId, mixed $messageFields) : mixed
Parameters
- $messageId : mixed
- $messageFields : mixed
Tags
onMessageAdd()
Event handler on message add.
public
static onMessageAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Message Id.
- $messageFields : array<string|int, mixed>
-
Event arguments.
Tags
Return values
boolonMessageDelete()
public
static onMessageDelete(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Message Id.
- $messageFields : array<string|int, mixed>
-
Event arguments.
Return values
boolonMessageUpdate()
public
static onMessageUpdate(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
- $messageId : int
-
Message Id.
- $messageFields : array<string|int, mixed>
-
Event arguments.
Return values
boolonReceiveCommand()
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 Called from @see \Bitrix\ImBot\Controller::sendToBot
Parameters
- $command : string
- $params : array<string|int, mixed>
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.
Return values
boolonStartWriting()
public
static onStartWriting(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
Tags
Return values
boolonWelcomeMessage()
Compatibility alias to the onChatStart method.
public
static onWelcomeMessage(mixed $dialogId, mixed $joinFields) : mixed
Parameters
- $dialogId : mixed
- $joinFields : mixed
Tags
register()
Register bot at portal.
public
static register([array{CODE: string, NAME: string} $params = [] ]) : bool|int
Parameters
- $params : array{CODE: string, NAME: string} = []
Return values
bool|intregisterApps()
Register bot's command.
public
static registerApps([int|null $botId = null ]) : bool
Parameters
- $botId : int|null = null
Return values
boolregisterCommands()
Register bot's command.
public
static registerCommands([int|null $botId = null ]) : bool
Parameters
- $botId : int|null = null
Return values
boolregisterConnector()
public
static registerConnector(int $lineId[, array<string|int, mixed> $fields = [] ]) : array<string|int, mixed>|bool
Parameters
- $lineId : int
- $fields : array<string|int, mixed> = []
Return values
array<string|int, mixed>|boolreplacePlaceholders()
Replaces standard placeholders.
public
static replacePlaceholders(string $message[, int $userId = 0 ]) : string
Parameters
- $message : string
- $userId : int = 0
Return values
stringscheduleAction()
public
static scheduleAction(string $target, string $action[, string $code = '' ][, int $delayMinutes = 1 ]) : void
Parameters
- $target : string
- $action : string
- $code : string = ''
- $delayMinutes : int = 1
scheduledActionAgent()
public
static scheduledActionAgent(string $target, string $action[, string $code = '' ]) : string
Parameters
- $target : string
- $action : string
- $code : string = ''
Return values
stringsearch()
Looks for the network openline.
public
static search(string $text[, bool $doNotCheckBlackList = false ]) : bool|array<string|int, mixed>
Parameters
- $text : string
-
Search string. Openline's name or exact code.
- $doNotCheckBlackList : bool = false
Tags
Return values
bool|array<string|int, mixed> —Command arguments.
[ 0 => [ (string) CODE, (string) LINE_NAME, (string) LINE_DESC, (string) LINE_WELCOME_MESSAGE, (string) LINE_AVATAR, (bool) VERIFIED, ], ...
sendMessage()
Sends message to client.
public
static sendMessage(array<string|int, mixed> $messageFields) : array<string|int, mixed>
Parameters
- $messageFields : array<string|int, mixed>
-
Command arguments.
[ (int) TO_USER_ID (int) FROM_USER_ID (string) DIALOG_ID (array) PARAMS (string) MESSAGE (array | \CIMMessageParamAttach) ATTACH (array | Keyboard) KEYBOARD (string) SYSTEM - N|Y (string) URL_PREVIEW - N|Y ]
Return values
array<string|int, mixed>sendNotifyChangeLicence()
Sends notify change licence.
public
static sendNotifyChangeLicence(array<string|int, mixed> $params) : bool
Parameters
- $params : array<string|int, mixed>
-
Command arguments.
[ (string) PREVIOUS_LICENCE_TYPE (string) PREVIOUS_LICENCE_NAME (string) CURRENT_LICENCE_TYPE (string) CURRENT_LICENCE_NAME (string) PREVIOUS_BOT_CODE (string) CURRENT_BOT_CODE (string) MESSAGE ]
Tags
Return values
boolsendRequest()
public
static sendRequest(string $supportCode[, string|null $supportName = null ]) : bool
Parameters
- $supportCode : string
- $supportName : string|null = null
Return values
boolsendRequestFinalizeSession()
Sends finalize session notification.
public
static sendRequestFinalizeSession([array<string|int, mixed> $params = [] ]) : bool
Parameters
- $params : array<string|int, mixed> = []
-
[ (string) MESSAGE ]
Return values
boolsendUnregisterRequest()
Sends unregister bot request.
public
static sendUnregisterRequest(string $code, int $botId) : bool
Parameters
- $code : string
-
Open line code.
- $botId : int
-
Bot id.
Tags
Return values
boolsetBotId()
Saves new Id of the registered bot.
public
static setBotId(int $id) : bool
Parameters
- $id : int
Return values
boolsetNetworkBotId()
Saves new open line bot id.
public
static setNetworkBotId(string $lineCode, int $botId) : bool
Parameters
- $lineCode : string
-
Line code.
- $botId : int
-
Bot Id.
Return values
boolsetOptions()
public
static setOptions(string $supportCode[, string|null $supportName = null ]) : bool
Parameters
- $supportCode : string
- $supportName : string|null = null
Return values
boolsetQuestionLimit()
Returns the limit for additional questions.
public
static setQuestionLimit(int $limit[, int|null $botId = null ]) : void
Parameters
- $limit : int
-
-1 - Functional is disabled, 0 - There is no limit, n - Max number for sessions allowed.
- $botId : int|null = null
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
boolunRegisterConnector()
public
static unRegisterConnector(int $lineId) : bool|array<string|int, mixed>
Parameters
- $lineId : int
Return values
bool|array<string|int, mixed>updateBotProperties()
public
static updateBotProperties() : bool
Return values
boolupdateConnector()
public
static updateConnector(int $lineId, array<string|int, mixed> $fields) : bool|array<string|int, mixed>
Parameters
- $lineId : int
- $fields : array<string|int, mixed>
Return values
bool|array<string|int, mixed>uploadAvatar()
Dowlloads user avatar via supplied image url.
public
static uploadAvatar([string $avatarUrl = '' ][, string $hash = '' ]) : array<string|int, mixed>|string
Parameters
- $avatarUrl : string = ''
-
Image url.
- $hash : string = ''
-
Salt string for auto naming.
Return values
array<string|int, mixed>|stringuploadIcon()
public
static uploadIcon(mixed $iconName) : bool|int
Parameters
- $iconName : mixed