JavaScript API
The web SDK exposes window.zorvia after its script loads.
init(config)
Initializes and mounts Messenger. It returns a promise.
Required configuration:
open() and close()
Programmatically control the Messenger panel:
identify(data)
Associates the active visitor session with a server-signed identity. It returns a promise. Follow the visitor identification flow to create the signed payload.
destroy()
Disconnects real-time updates, unmounts Messenger, and removes its container:
Errors
Rejected init() and identify() promises use a ZorviaError with code, operation, and an optional statusCode.
configuration_error— A required SDK configuration value is missing or invalid.authentication_error— The public messenger key could not be authenticated. The status code is401.forbidden— The current domain is not allowed to use the Zorvia Messenger channel. The status code is403.validation_error— The request sent by the SDK failed validation. The status code is422.network_error— The SDK could not reach Zorvia, or Zorvia returned a server error.initialization_failed— Zorvia Messenger could not initialize.identification_failed— The SDK could not identify the visitor.unknown_error— An unexpected error occurred.
