boot
Initialize the chat instance and mount it
const options: {
theme_color?: string;
header_title?: string;
header_description?: string;
enable_tab_notification?: boolean;
tab_notification_text?: string;
hide_launcher?: boolean;
launcher_image?: string;
url_scheme_safe_list?: string[];
language?: 'en' | 'ja';
reply_time?: 'a_few_minutes' | 'tens_of_minutes' | 'a_few_hours' | 'a_day';
business_hours: {
dayOfWeeks: number[];
timeRanges: {
from: number;
to: number;
}[];
};
horizontal_spacing_pc?: number;
horizontal_spacing_mobile?: number;
vertical_spacing_pc?: number;
vertical_spacing_mobile?: number;
placement_pc?: 'right' | 'left';
placement_mobile?: 'right' | 'left';
} = {}
krt('talk', 'boot', options);
shutdown
Shutdown chat module
krt('talk', 'shutdown');
show
Show messenger
krt('talk', 'show');
hide
Hide messenger
krt('talk', 'hide');
setMessageInTextArea
Set message in the text area.
And show messenger if not shown.
krt('talk', 'setMessageInTextArea', {
text: 'hello'
});
sendFromUser
Send message as user.
krt('talk', 'sendFromUser', {
text: 'hello'
})
onShow
Register a callback function when the messenger is shown.
krt('talk', 'onShow', () => {
// YOUR CODE...
});
onHide
Register a callback function when the messenger is hidden.
krt('talk', 'onHide', () => {
// YOUR CODE...
});
onChangeUnreadMessageCount
Register a callback function when the number of unread messages has changed.
If execInitialized is true
, the callback function is also executed on initial load.(optional)
const options: {
execInitialized?: boolean
} = {}
krt('talk', 'onChangeUnreadMessageCount', ({ count }) => {
// YOUR CODE...
}, options);
onChangeAssignee
Register a callback function when the assignee has changed.
If execInitialized is true
, the callback function is also executed on initial load.(optional)
const options: {
execInitialized?: boolean
} = {}
krt('talk', 'onChangeAssignee', ({ assigneeId }) => {
// YOUR CODE...
}, options);
onChangeChatStatus
Register a callback function when the chatStatus has changed.
chatStatus
is one of the following: open
or closed
or waiting
.
If execInitialized is true
, the callback function is also executed on initial load.(optional)
const options: {
execInitialized?: boolean
} = {}
krt('talk', 'onChangeChatStatus', ({ chatStatus }) => {
// YOUR CODE...
}, options);
setMetadata
Set metadata.
krt('talk', 'setMetadata', {key: string, value: string});
fetchOperatorCounts
Fetch operator counts.
krt('talk', 'fetchOperatorCounts', ({ operatorCounts }) => {
const { all, available, online } = operatorCounts;
// YOUR CODE...
});