Feature referenceDeveloper integration · 01 of 05

Developer integration

Stand JavaScript API

The public window.StandChat API lets a website reveal its own chat entry points, inspect responder availability, open Stand with page-specific context, and identify a signed-in visitor.

Availability
All plans
Configured in
Website code → window.StandChat after the Stand embed script executes
Category
Developer integration
Reference status
Current
01

What the JavaScript API controls

window.StandChat is the public interface created by the Stand embed script. Use it when an existing website control—such as a pricing button, comparison table, booking flow, or application menu—should open Stand without using Stand’s own button or card component.

The API separates script readiness from responder availability. The global object may already exist while Stand is still looking for a live rep or AI Stand-in, so custom UI should use whenAvailable(...) before becoming visible or actionable.

Calls operate on the widget installed on the current page. They do not provide server-side access to Stand data.

02

Connect a custom page control

Install Stand on the page first. Then wait until both the page control and window.StandChat exist, register an availability callback, and reveal the control only after the callback runs.

Open Stand from an existing button
const button = document.querySelector("[data-ask-pricing]")

window.StandChat.whenAvailable((responder) => {
  button.hidden = false
  button.textContent = `Ask ${responder.name || "us"} about pricing`
})

button.addEventListener("click", () => {
  window.StandChat.openChat(
    "I can help compare plans. What would you like to know?"
  )
})

On asynchronously rendered pages, also guard for window.StandChat itself before registering the callback.

03

Public methods

MethodBehaviorReturn or timing
initiallyHideChatButton()Suppresses the default floating launcher until page code opens Stand.Returns nothing. A later openChat(...) reveals and opens the widget.
openChat(repMessage = "")Opens chat. A non-empty string replaces the configured opening greeting for this activation.Returns nothing. A request made while the UI loads is queued; if no responder is available, nothing opens.
openChat(repMessage, visitorMessage, prompt)Also sends non-blank visitor text as the first visitor message and attaches private context.The visitor message is visible in the transcript; the prompt is not visitor-authored text.
openChat(repMessage, options)Accepts visitorMessage, prompt, visitorIdentity, sourceType, analyticsId, and interaction for custom integrations.visitorIdentity applies to the session created by this open request.
identify(identity)Sets { externalId, name? } for future sessions, or clears it with null.Returns nothing; it does not modify an active session.
isAvailable()Reports whether Stand has found an eligible responder.Boolean. false also covers a lookup that has not finished.
whenAvailable(callback)Runs the callback with { available, human, name, title, avatarUrl, brandName } when a responder is available.Runs immediately if already available and returns an unsubscribe function.
isHuman()Reports whether the available responder is a live person.false can mean AI or not yet available.
getName(), getTitle(), getAvatar()Read responder identity for custom page UI.Return a string, or an empty string before availability.
04

Opening messages and attribution

  • repMessage is the first visible message from the rep or Stand-in for that activation; an empty value keeps the configured greeting.
  • visitorMessage becomes an actual visitor-authored transcript message. Empty or whitespace-only values are ignored.
  • prompt is private page context used by the responder and retained with the conversation; visitors do not see it as their message.
  • sourceType, analyticsId, and interaction attribute the activation. The default source for direct API calls is public_api.
  • visitorIdentity supplies a stable external ID and optional name to only the session created by that request.
05

Lifecycle and cleanup

  • The embed script may be deferred or loaded after application code. Do not assume the global exists at the first page script execution.
  • Availability is positive-only: custom controls are revealed when a responder is found. A false check does not distinguish “still loading” from “unavailable.”
  • whenAvailable(...) immediately supplies a copied current availability object when Stand is already ready.
  • Save and call the unsubscribe function when a React, Vue, or other single-page component unmounts.
  • Prefer stand-button or stand-card when their declarative behavior is sufficient; they handle readiness and availability automatically.
06

Boundaries and failure behavior

  • Calling openChat(...) cannot bypass routing or create a conversation when the site has no eligible responder.
  • Getter values can be empty until availability is known.
  • The API does not return contact details, conversation history, messages, authentication state, or private Stand credentials.
  • Page-supplied identity and prompt values are application-provided context, not proof of identity or permission.
  • Custom JavaScript configured in a Site behavior rule is a separate, owner-enabled experiment surface; this API is the supported integration contract for website code.