- Maximize chat window: generates the maximized view of the chat window.
$aivo.chat.maximize();
- Open chat window: opens the chat window and hides the initiator.
$aivo.chat.open();
- Logout and close chat window: minimizes the chat window and ends the current session, deleting the chat history. Re-displays the chat launcher.
-
$aivo.chat.close();
-
- Close chat window (minimize): minimizes the chat window and redisplays the chat launcher. The chat history is not deleted, and the current session remains active.
$aivo.chat.minimize()
- Send a message to the user (as if sent by the bot): adds a message to the chat window, it is displayed as a message from the Bot
aivo.chat.addMessage("Hello customer, I'm AgentBot");
- Send a message to the bot(as if sent by the user): Adds a message to the chat window, which is displayed as a message sent by the user.
$aivo.chat.sendMessage("Hello, I need help");
$aivo.chat.sendMessage("Hello, I need help", { hideUserMessage: true }); The optional parameter hideUserMessage:true hides the user's message in the chat window. However, if the user refreshes or reloads the page, the hidden message will be displayed in the chat history.
$aivo.chat.sendMessage("Hello, I need help", { hideUserMessage: false }); The optional parameter hideUserMessage:false displays the user's message in the chat window.
$aivo.chat.sendMessage("Hello, I need help", { resetBeforeSend: true }); The optional parameter resetBeforeSend: true internally ends the chat session before sending the message, causing the user id to change.
$aivo.chat.sendMessage("Hello, I need help", { resetBeforeSend: false }); The optional parameter resetBeforeSend: false does not end the chat session before sending the message.
- Hide chat launcher: hides the chat launcher if it is visible. It is important to clarify that the window must first be minimized or closed (through the "close" or "minimize" events); otherwise, it does not perform any action.
$aivo.launcher.hide();
- Show chat launcher: if the start button was previously hidden, it will be shown again through this event.
$aivo.launcher.show()
- Remove the chat launcher: permanently remove the launcher button. Therefore, to show it again, the Aivo script must be loaded again.
$aivo.launcher.remove();
- Hide the minimization bar on the mobile: This allows you to hide the minimization bar on the mobile.
// Show $aivo.launcher.hideSticky(false);
// Hide $aivo.launcher.hideSticky(true);
- Show or hide the close chat icon (X): show or hide the close chat icon (X) located in the upper right margin of the header.
- // show the icon $aivo.chat.showCloselcon(true);
- // hide the icon $aivo.chat.showCloselcon(false);
- Send to satisfaction survey: allows sending the satisfaction survey to the chat window. This will only work in cases where the survey is previously activated in the Aivo Platform and, in addition, there is an interaction with the bot.
$aivo.chat.closeToSurvey();
- End session without minimizing the chat window: ends the current session, deleting the chat history, without minimizing the window. Displays the chat initiator again.
$aivo.chat.resetWindow()
- Prevents the display of messages older than the time limit set by the 'hours' parameter in the window's chat history. That is, after X number of hours, old messages will be hidden. This parameter can be an integer or a decimal number. The calculation of the time elapsed since the message was sent is carried out taking into account the browser settings of the window user and their time zone.
$aivo.chat.cleanUpChatHistory(hours)
- Set the aesthetics and functionality of the chat window for applications: When running this command, the window will not display the maximize, minimize, or close icons. It will also not be draggable, and on mobile devices, it will occupy 100% of the available width and height.
$aivo.chat.embed();
- Close Webview: closes the webview that is currently open in the app. This command will only take effect if a Webview is open during execution.
$aivo.chat.closeWebview();
- Check if a Webview is open in the application: When running the command, if it returns true, it indicates that a Webview is currently open; if it returns false, it indicates that it is not.
$aivo.chat.isWebviewOpen();