Customer Agent

Options

CustomerAgentOptions accepted by the Customer Agent SDK.

CustomerAgentOptions

type WidgetLauncherVariableName =
  | "bg-color"
  | "color"
  | "border-color"
  | "border-radius"
  | "border-style"
  | "border-width"
  | "box-shadow"
  | "hover-bg-color"
  | "hover-color"
  | "hover-border-color"
  | "hover-border-radius"
  | "hover-border-style"
  | "hover-border-width"
  | "hover-box-shadow"

type WidgetLauncherVariables = Partial<
  Record<WidgetLauncherVariableName, number | string | undefined>
>

type WidgetHeaderOptions = {
  close?: boolean
  menu?: boolean
}

type WidgetPageOptions = {
  customerOrigin?: string
  pagePath?: string
  pageUrl?: string
}

type CustomerAgentOptions = {
  app_id: string
  anonymous_id?: string
  brand?: { name?: string }
  context?: WidgetContextJson
  context_ready?: boolean
  header?: WidgetHeaderOptions
  launcher?: {
    target?: HTMLElement | string
    placement?: "top" | "right" | "bottom" | "left"
    offset?: number
    style?: Record<string, number | string | undefined>
    variables?: WidgetLauncherVariables
  }
  locale?: string
  messages?: WidgetLocaleMessages
  mobile?: { mode?: "fullscreen" | "bottom-sheet" }
  mount?: HTMLElement | string
  open_on_init?: boolean
  page?: WidgetPageOptions
  position?: "bottom-right" | "bottom-left"
  theme?: {
    colorScheme?: "light" | "dark" | "system"
    primaryColor?: string
    radius?: number
  }
  user?: WidgetUser
}

Fields

OptionTypeRequiredEffectNotes
app_idstringYesCustomer Agent app identifier.Missing values throw.
anonymous_idstringNoStable logged-out visitor identifier.Used before a known user id is available.
brand.namestringNoMessenger brand display name.Overrides configured brand name.
contextWidgetContextJsonNoInitial user context.Later updates can use setContext.
context_readybooleanNoInitial context readiness.Later updates can use setContext(..., { ready }).
header.closebooleanNoControls the panel close action.Enabled unless set to false.
header.menubooleanNoControls the header more-options menu.Enabled unless set to false.
launcher.targetHTMLElement | stringNoHost element used as launcher.Selector misses fall back to default launcher.
launcher.placement"top" | "right" | "bottom" | "left"NoDesktop panel placement.Applies to launcher anchoring.
launcher.offsetnumberNoDesktop panel offset in pixels.Negative values are clamped to zero.
launcher.styleRecord<string, number | string | undefined>NoInline style fields for the default launcher container.color also applies to the default launcher button.
launcher.variablesWidgetLauncherVariablesNoDefault launcher button style variables.Values are resolved from the host document before iframe application.
localestringNoLocale override.Omit to use host locale resolution.
messagesWidgetLocaleMessagesNoUI message overrides.Partial message map.
mobile.mode"fullscreen" | "bottom-sheet"NoMobile presentation preference.See Mobile presentation.
mountHTMLElement | stringNoMount target.Selector misses fall back to document.body.
open_on_initbooleanNoOpens Messenger after boot.Does not emit widget.opened.
page.customerOriginstringNoPage origin metadata sent with conversation context.Overrides automatic page origin detection.
page.pagePathstringNoPage path metadata sent with conversation context.Overrides automatic page path detection.
page.pageUrlstringNoPage URL metadata sent with conversation context.Overrides automatic page URL detection.
position"bottom-right" | "bottom-left"NoDefault launcher position.Applies to the SDK default launcher.
theme.colorScheme"light" | "dark" | "system"NoColor scheme.Messenger UI theme preference.
theme.primaryColorstringNoPrimary color.CSS color string.
theme.radiusnumberNoCorner radius.Numeric radius value.
userWidgetUserNoInitial visitor identity.Use user.id for a stable logged-in user id.
TypeReference
WidgetUserIdentity and context
WidgetContextJsonIdentity and context
WidgetLocaleMessagesMessage keys listed below.

Page Metadata

page.customerOrigin, page.pagePath, and page.pageUrl override the page metadata that the SDK detects from the current browser location. These fields are sent as conversation context metadata. They do not change context; user-defined context values remain under userContext.

header.close controls the panel-level close action in the top-right corner. When it is false, the Messenger does not render that close action. This is useful for mounted or WebView integrations where the host app owns navigation and dismissal.

header.menu controls the more-options menu in Messenger headers. When it is false, support and interview headers do not render the menu action. When omitted or true, the menu action is available when that header has menu items.

Mobile Presentation

mobile.mode controls the Messenger presentation selected for mobile viewports. Setting mobile.mode does not force wider viewports to use a mobile presentation.

ValueEffect
"fullscreen"Uses the desktop presentation on wider viewports and fullscreen on mobile viewports.
"bottom-sheet"Uses the desktop presentation on wider viewports and bottom-sheet on mobile viewports.

When a non-mounted Messenger opens in fullscreen presentation, the SDK prevents the host page from scrolling behind the Messenger. Host page scrolling is restored when the Messenger closes, shuts down, or updates away from fullscreen presentation. When mount is set, the SDK treats the Messenger as mounted content and does not lock host page scrolling.

Launcher Styling

launcher.variables customizes the SDK default launcher button inside its iframe. The option accepts only the short keys listed below; unsupported keys have no effect. Values may reference host CSS custom properties, such as "var(--primary)". The SDK resolves the value from the host document before applying it to the default launcher iframe.

launcher: {
  variables: {
    "bg-color": "var(--primary)",
    color: "var(--primary-foreground)",
    "hover-bg-color": "var(--primary-hover)"
  }
}
VariableEffect
bg-colorBase background color.
colorBase icon/text color.
border-colorBase border color.
border-radiusBase border radius.
border-styleBase border style.
border-widthBase border width.
box-shadowBase box shadow.
hover-bg-colorHover background color.
hover-colorHover icon/text color.
hover-border-colorHover border color.
hover-border-radiusHover border radius.
hover-border-styleHover border style.
hover-border-widthHover border width.
hover-box-shadowHover box shadow.

launcher.style is the public inline style map for the SDK default launcher container. Its color field also sets the default launcher button color inside the iframe. CustomerAgentOptions does not declare launcher.className. Class names applied to host-side elements and containers do not style the default launcher button inside the iframe. For iframe button styling, use launcher.variables or public inline style fields such as launcher.style.color.

Launcher Geometry

The Messenger panel opens from the resolved launcher position. On desktop, expanded and collapsed sizes resize from that launcher anchor while respecting viewport safe space.

WidgetLocaleMessages

KeyDefault meaningPlaceholders
add_emojiEmoji picker label.None
assistant_author_aiAI assistant author label.None
assistant_author_humanHuman support author label.None
attachment_labelAttachment button label.None
close_chatClose action label.None
collapse_windowCollapse action label.None
download_transcriptTranscript download action label.None
expand_windowExpand action label.None
input_placeholderSupport composer placeholder.None
interview_input_placeholderInterview composer placeholder.None
interview_session_descriptionInterview header description.None
launcher_closeLauncher close label.{title}
launcher_openLauncher open label.{title}
message_aria_labelMessage ARIA label.None
more_optionsMore options action label.None
relative_time_todayToday label.None
relative_time_yesterdayYesterday label.None
relative_time_dayRelative day label.{count}
relative_time_hourRelative hour label.{count}
relative_time_minuteRelative minute label.{count}
relative_time_nowCurrent-time label.None
remove_attachmentAttachment removal label.{name}
send_messageSend message action label.None
status_reply_timeReply-time status copy.None
support_chat_labelMessenger ARIA label.{title}
welcome_messageInitial welcome message.None

On this page