> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vzaps.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Chatwoot

> Configure Chatwoot integration and import data with the Java SDK

Use `client.chatwoot()` to connect a VZaps instance to Chatwoot.

Common fields on every call:

| Field           | Type     | Required | Description     |
| --------------- | -------- | -------- | --------------- |
| `instanceId`    | `string` | Yes      | Instance ID.    |
| `instanceToken` | `string` | Yes      | Instance token. |

## `client.chatwoot().get(...)`

Reads the current configuration, including `webhookUrl` and `tokenMasked` when applicable.

```java theme={null}
var options = InstanceRequestOptions.builder().instanceToken(instanceToken).build();
JsonNode result = client.chatwoot().get(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .build());
// Example: tipagem estrita com DTOs publicados quando disponivel
```

**Return:** Chatwoot config (`enabled`, `url`, `account_id`, `webhook_url`, `token_masked`, etc.).

## `client.chatwoot().set(...)`

Creates or updates the instance Chatwoot integration.

```java theme={null}
var options = InstanceRequestOptions.builder().instanceToken(instanceToken).build();
JsonNode result = client.chatwoot().set(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .build());
// Example: tipagem estrita com DTOs publicados quando disponivel
```

**Return:** saved config (includes `webhook_url` when generated).

Main payload fields:

| Field                     | Type      | Required | Description                                 |
| ------------------------- | --------- | -------- | ------------------------------------------- |
| `enabled`                 | `boolean` | Yes      | Enables or disables the integration.        |
| `url`                     | `string`  | Yes      | Chatwoot base URL.                          |
| `accountId`               | `string`  | Yes      | Numeric account ID.                         |
| `token`                   | `string`  | Yes      | Chatwoot API token.                         |
| `nameInbox`               | `string`  | No       | API inbox name.                             |
| `autoCreate`              | `boolean` | No       | Auto-create inbox and webhook.              |
| `importContacts`          | `boolean` | No       | Import contacts in the initial flow.        |
| `importMessages`          | `boolean` | No       | Import messages in the initial flow.        |
| `daysLimitImportMessages` | `number`  | No       | Message import window in days. Minimum `1`. |
| `ignoreGroups`            | `boolean` | No       | Ignore group messages.                      |
| `ignoreJids`              | `array`   | No       | JIDs to ignore.                             |

<Tip>
  Copy `webhookUrl` from the response into the Chatwoot API inbox when `autoCreate` does not apply it automatically.
</Tip>

## `client.chatwoot().delete(...)`

Removes the Chatwoot integration from the instance.

```java theme={null}
var options = InstanceRequestOptions.builder().instanceToken(instanceToken).build();
JsonNode result = client.chatwoot().delete(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .build());
// Example: tipagem estrita com DTOs publicados quando disponivel
```

**Return:** integration removal confirmation.

## `client.chatwoot().triggerImport(...)`

Triggers a manual import of contacts, messages, or both.

Import contacts:

```java theme={null}
var options = InstanceRequestOptions.builder().instanceToken(instanceToken).build();
JsonNode result = client.chatwoot().triggerImport(GenericInstanceRequest.builder()
    .instanceId(instanceId)
    .instanceToken(instanceToken)
    .build());
// Example: tipagem estrita com DTOs publicados quando disponivel
```

**Return:** import job confirmation (`contacts`, `messages`, or `all`).

Import messages:

```ts theme={null}
await vzaps.chatwoot.triggerImport({
  instanceId: 'VZ...',
  instanceToken: 'instance-token',
  what: 'messages',
});
```

Import all:

```ts theme={null}
await vzaps.chatwoot.triggerImport({
  instanceId: 'VZ...',
  instanceToken: 'instance-token',
  what: 'all',
});
```

Accepted values for `what`: `contacts`, `messages`, `all`.
