Skip to main content

Configuration (window.civchat)

The window.civchat object is defined before the SDK script loads. It configures the initial state, contact identification, and event callbacks. See Installation for where the object goes in your page.

Properties​

Optional unless marked required

apiKeyStringrequired
Your application API key from Settings > Workspace Settings > API & Integrations > Setup & Integrations.

Common Contact Attributes: The following standard attributes can be set during initialization:

user_idString
Unique contact identifier for precise tracking. Takes precedence over email-based identification.
emailString
Contact email address. Subject to Unified Identification logic when user_id is not provided.
first_nameString
Contact's first name.
last_nameString
Contact's last name.
phone_numberString
Contact's phone number.

Custom Attributes: Any additional properties are treated as custom contact attributes. For the complete attribute list, the formatting rules, and company association, see Additional contact data.

Callbacks​

CallbackArgumentsDescription
onLoadNoneTriggered when the widget script and resources finish loading.
onPayloadReceivedmessage (String)Triggered when receiving payloads from automation "Send Code" modules.
onMessagemessage (Object)Triggered on incoming chat messages. Object contains content and isAdmin properties.
onOpenNoneTriggered when the widget expands/opens.
onCloseNoneTriggered when the widget minimizes/closes.

For detailed callback implementation, see Widget callbacks.