We can add the following fields are custom. If they are not added, the Chat will show the default values.
window.plugins.indigitall.chat.init({
channelKey: "your_channel_key",
//opciones personalizables
externalCode:"your_external_code",
titleChat: "your_title_chat",
botName:"your_bot_name",
defaultUserName:"your_default_username",
messagePlaceholder:"your_message_place_holder",
openFileText:"your_open_file_text",
primaryColor:"your_primary_color",
backgroundChatColor:"your_background_chat_color",
backgroundBarColor:"your_background_bar_color",
fullscreen:"bool",
zIndex: "your_z_index",
openFileText: 'your_text_open_file'
fullscreen: false,
defaultChatIconResource: 'your_chat-bubble',
logLevel: logLevel,
infoContactTopBarTitle: 'your_title_top_bar_info_contact',
welcomeLabel:
{
title: 'your_title_wellcome_label',
body: 'your_body_wellcome_label',
icon: 'icon_wellcome_label',
backgrounColor: 'your_color_wellcome_label',
textColor: 'your_text_color_wellcome_label',
closeIcon: 'your_close_icon_wellcome_label',
closeIconBackGroundColor: 'your_backgrounColor_close_icon_wellcome_label',
delay: 'your_delay_to_show_wellcome_label'
}
chatAutoOpenTime: "your-chat_auto_open_time_in_seconds",
clearMessages: true,
welcomeEvent: 'your_event',
welcomeMessage: 'your_custom_html'
},()=>{
//DO SOMETHING
}, (error)=>{
//DO SOMETHING
});
- your_channel_key is an alphanumeric string that identifies your indigitall project.
The following fields are custom. If they are not added, the Chat will show the default values.
- your_external_code is a string that identifies each device.
- your_title_chat is a string with the title that you want to be shown in the chat.
- your_bot_name is a string with the name of the bot that will be displayed above the bubble on the left side.
- your_default_username is a string with the default name that the user will have and will be displayed above the user's bubble.
- your_message_place_holder is a string with the message that is displayed in the text field where it must be written.
- your_open_file_text is a string with the text that will be displayed in the case a file has to be downloaded.
- your_background_chat_color is a string with the chat background color in hexadecimal.
- your_background_bar_color is a string with the background color of the top and bottom bars in hexadecimal.
- your_primary_color is a string with the main color of the chat, buttons and floating icon in hexadecimal.
- fullscreen is a boolean where you indicate if you want the chat to occupy the entire screen (true) or have a certain margin of the device (false).
- your_z_index numeric indicator to position the chat on the z axis.
- your_text_open_file It is a string with the text that will be displayed in the case a file has to be downloaded.
- your_log_level indicates log you can see
- wellcomeLabel show the wellcome label with the optional fields as json object.
- infoContactTopBarTitle is a string top bar title of info contact view.
- chatAutoOpenTime is an integer that indicates the seconds for the chat to open automatically. If no chatAutoOpenTime is specified, such as if you press the bubble before the specified time expires, the chat can be opened manually.
- clearMessages is a boolean that indicate if you want to delete or clear all messages from session storage every time you open the chat
- welcomeEvent is a string to define the welcome message one time you open the chat
- welcomeMessage is a string with custom html type by user to show as first message when chat is open.
Functionalities
You can check if the welcome event has been fired with this method:
let isEmitted = window.plugins.indigitall.chat.isWelcomeEmitted((isEmitted) => {
//success
}, (error)=> {
//Log error
});
If you want to send a message custom you can use this method:
window.plugins.indigitall.chat.setCustomEvent("Your_event", () => {
//success
}, (error)=> {
//Log error
});
You can also control the action of deleting messages with this method:
window.plugins.indigitall.chat.clearAllMessages(() => {
//success
}, (error)=> {
//Log error
});