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​

PropertyTypeRequiredDescription
apiKeyStringYesYour application API key from Settings > Workspace Settings > API & Integrations > Setup & Integrations.

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

PropertyTypeDescription
user_idStringUnique contact identifier for precise tracking. Takes precedence over email-based identification.
emailStringContact email address. Subject to Unified Identification logic when user_id is not provided.
first_nameStringContact's first name.
last_nameStringContact's last name.
phone_numberStringContact'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.