---
updatedAt: 2025-09-16T21:41:09.000Z
agentTools:
  projectIndex: https://developers.karte.io/llms.txt
---

# krt('talk')

KARTE Talkのチャットv4で利用できるJS APIになります。

# boot

Initialize the chat instance and mount it

```typescript
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

```typescript
krt('talk', 'shutdown');
```

# show

Show messenger

```javascript
krt('talk', 'show');
```

# hide

Hide messenger

```javascript
krt('talk', 'hide');
```

# setMessageInTextArea

Set message in the text area.\
And show messenger if not shown.

```javascript
krt('talk', 'setMessageInTextArea', {
  text: 'hello'
});
```

# sendFromUser

Send message as user.

```javascript
krt('talk', 'sendFromUser', {
  text: 'hello'
})
```

# onShow

Register a callback function when the messenger is shown.

```javascript
krt('talk', 'onShow', () => {
   // YOUR CODE...
});
```

# onHide

Register a callback function when the messenger is hidden.

```javascript
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)

```javascript
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)

```javascript
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)

```javascript
const options: {
  execInitialized?: boolean
} = {}
krt('talk', 'onChangeChatStatus', ({ chatStatus }) => {
   // YOUR CODE...
}, options);
```

# setMetadata

Set metadata.

```javascript
krt('talk', 'setMetadata', {key: string, value: string});
```

# fetchOperatorCounts

Fetch operator counts.

```javascript
krt('talk', 'fetchOperatorCounts', ({ operatorCounts }) => {
  const { all, available, online } = operatorCounts;
  // YOUR CODE...
});
```