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. |
Chatwoot.Get(ctx, instanceID, options)
Reads the current configuration, including webhook_url and token_masked when applicable.
chatwoot, err := client.Chatwoot.Get(ctx, "VZ...", vzaps.InstanceOptions{
InstanceToken: "instance-token",
})
fmt.Printf("%#v\n", chatwoot)
Return: Chatwoot config (enabled, url, account_id, webhook_url, token_masked, etc.).
Chatwoot.Set(ctx, req)
Creates or updates the instance Chatwoot integration.
saved, err := client.Chatwoot.Set(ctx, vzaps.ChatwootRequest{
InstanceScopedRequest: vzaps.InstanceScopedRequest{
InstanceID: "VZ...",
InstanceToken: "instance-token",
},
Enabled: true,
URL: "https://app.chatwoot.com",
AccountID: "1",
Token: "chatwoot-api-token",
NameInbox: "WhatsApp VZaps",
SignMsg: true,
SignDelimiter: "\n",
Number: "5511999999999",
ReopenConversation: true,
ConversationPending: false,
ImportContacts: true,
ImportMessages: true,
DaysLimitImportMessages: 30,
AutoCreate: true,
Organization: "My company",
Logo: "",
IgnoreGroups: false,
IgnoreJids: []any{},
})
fmt.Printf("%#v\n", saved)
Return: saved config (includes webhook_url when generated).
Main payload fields:
| Field (JSON) | Go field | Required | Description |
|---|
enabled | Enabled | Yes | Enables or disables the integration. |
url | URL | Yes | Chatwoot base URL. |
account_id | AccountID | Yes | Numeric account ID. |
token | Token | Yes | Chatwoot API token. |
name_inbox | NameInbox | No | API inbox name. |
auto_create | AutoCreate | No | Auto-create inbox and webhook. |
import_contacts | ImportContacts | No | Import contacts in the initial flow. |
import_messages | ImportMessages | No | Import messages in the initial flow. |
days_limit_import_messages | DaysLimitImportMessages | No | Message import window in days. Minimum 1. |
ignore_groups | IgnoreGroups | No | Ignore group messages. |
ignore_jids | IgnoreJids | No | JIDs to ignore. |
Copy webhook_url from the response into the Chatwoot API inbox when AutoCreate does not apply it automatically.
Chatwoot.Delete(ctx, instanceID, options)
Removes the Chatwoot integration from the instance.
_, err := client.Chatwoot.Delete(ctx, "VZ...", vzaps.InstanceOptions{
InstanceToken: "instance-token",
})
Return: integration removal confirmation.
Chatwoot.TriggerImport(ctx, req)
Triggers a manual import of contacts, messages, or both.
Import contacts:
_, err := client.Chatwoot.TriggerImport(ctx, vzaps.ChatwootImportRequest{
InstanceScopedRequest: vzaps.InstanceScopedRequest{
InstanceID: "VZ...",
InstanceToken: "instance-token",
},
What: "contacts",
})
Return: import job confirmation (contacts, messages, or all).
Import messages:
_, err := client.Chatwoot.TriggerImport(ctx, vzaps.ChatwootImportRequest{
InstanceScopedRequest: vzaps.InstanceScopedRequest{
InstanceID: "VZ...",
InstanceToken: "instance-token",
},
What: "messages",
})
Import all:
_, err := client.Chatwoot.TriggerImport(ctx, vzaps.ChatwootImportRequest{
InstanceScopedRequest: vzaps.InstanceScopedRequest{
InstanceID: "VZ...",
InstanceToken: "instance-token",
},
What: "all",
})
Accepted values for What: contacts, messages, all.