App Bridge Actions Reference
The App Bridge SDK exposes a class for each action family plus the rawdispatch / dispatchAndWait calls underneath. Use the classes when you can
— they validate types, manage subscriptions, and handle cleanup. Drop to the
raw API when you need an action the SDK hasn’t wrapped yet.
Calling Convention
The SDK signatures are:action is the string name (e.g. 'TOAST_SHOW'), not an object. The
SDK wraps the payload into the wire format
{ type: 'APP_BRIDGE_ACTION', action, payload, id } and posts it to the
host. The host responds with { type: 'APP_BRIDGE_RESPONSE', action, id, payload, error? }.
Action Catalogue
Cart and BuyerJourney are checkout-only. They’re documented in detail on the
Checkout App Bridge page. Everything else runs in the
admin host.
UI Actions
Toast (TOAST_SHOW)
Modal (MODAL_OPEN / MODAL_CLOSE)
{ title?, message?, url?, size?: 'small' | 'medium' | 'large' | 'full', primaryAction?: { label, onAction }, secondaryActions?: Array<{ label, onAction }> }. Host events (MODAL_PRIMARY_ACTION,
MODAL_SECONDARY_ACTION, MODAL_CLOSE) are matched to the modal by
modalId and routed to your callbacks. In React, prefer
useConfirmationModal
for an awaitable confirm dialog.
Loading (LOADING_START / LOADING_STOP)
Fullscreen (FULLSCREEN_ENTER / EXIT / TOGGLE)
Title Bar (TITLE_BAR_UPDATE)
Navigation
Redirect (REDIRECT)
Navigation Menu (NAV_MENU_UPDATE)
History (HISTORY_PUSH / REPLACE / BACK / FORWARD / GO)
Resource Picker (RESOURCE_PICKER_OPEN / CLOSE)
multiple: true lets the picker return more than one resource. Pass
selectionIds (an array of ids) to pre-select. The legacy
initialSelectionIds: [{ id }] shape still works but selectionIds is
the recommended shape going forward. On cancel the picker responds with
{ selection: [] } — selection is always an array and there is no
cancelled field; an empty selection is the cancel signal (class
consumers get the dedicated cancel event).
Response payload:
{ pickerId, selection: [...] } — selection is always an
array (length 1 for single-select; empty on cancel).
For non-file types each element is a stable handle string: handle for
product / collection / blog / article / page / menu, email for customer,
order_number for order, id for product_variant. Store the handle; resolve
extra fields server-side.
For file each element is a rich object so you get a usable URL
directly — no extra lookup needed:
The
file picker is the full Media Library — the merchant can search,
browse, and upload new files in-place, then
pick one or more. multiple: true returns several objects. id is the stable
mediaId; url is a permanent CDN URL. Other resource types select existing
records only.Save Bar (CONTEXTUAL_SAVE_BAR)
CONTEXTUAL_SAVE_BAR action with payload
{ action: 'SHOW' | 'HIDE' | 'UPDATE', ... }; the host emits
CONTEXTUAL_SAVE_BAR_SAVE / CONTEXTUAL_SAVE_BAR_DISCARD events which
the class routes to your subscribe callbacks — use the class.
Leave Confirmation (LEAVE_CONFIRMATION_ENABLE / DISABLE)
Session & Auth (SESSION_TOKEN_REQUEST)
app.getSessionToken() is a thin wrapper over
dispatchAndWait('SESSION_TOKEN_REQUEST') — it returns { token } but does
not cache. For caching + auto-refresh (reuse the token while more than
30s from its JWT exp, refresh otherwise), use the SessionToken action
class or the useSessionToken React hook.
User / Config / Environment / Features
USER_FETCH, CONFIG_FETCH, ENVIRONMENT_FETCH,
FEATURES_QUERY (raw only — the Features class does not dispatch it).
Browser APIs
Clipboard (CLIPBOARD_WRITE / CLIPBOARD_READ_REQUEST)
Scanner (SCANNER_OPEN / SCANNER_CLOSE)
capture() promise rejects with Error('Scanner cancelled') — there
is no cancelled field on a resolved payload.
Print (PRINT)
Share (SHARE)
Lifecycle
'focus' | 'blur' | 'visible' | 'hidden' — driven by the
iframe’s own focus/blur/visibilitychange plus the host-pushed
APP_FOCUS / APP_BLUR / APP_VISIBLE / APP_HIDDEN actions. There
are no mount/unmount events — run mount logic in your own bootstrap.
Checkout-only Surfaces
The following actions are wired into the customer-checkout host and the post-purchase host. See Checkout App Bridge for the full contract.Cart (CART_LINES_CHANGE, DISCOUNT_CODE_CHANGE, NOTE_CHANGE, ATTRIBUTE_CHANGE, GIFT_CARD_CHANGE)
Buyer Journey (BUYER_JOURNEY_INTERCEPT_REQUEST/RESPONSE)
Block the customer from advancing to payment until your condition is met.
Error Handling
Complete Example
I18n (I18N_UPDATE)
The host pushes the merchant’s admin locale to your iframe and re-pushes
on every change. Subscribe via the I18n action class — it caches the
last dictionary and exposes translate / formatNumber / formatDate
helpers backed by Intl.*.
{ locale: string, dictionary: Record<string,string> }.
The host derives locale from the admin’s cookie/localStorage and the
dictionary from /api/i18n/admin?locale=... (silently {} if the
endpoint is absent — your app should fall back to Intl.* for
formatting).
REST API (CONFIG_GET + session tokens)
Use the RestApi action class to call the LaunchMyStore REST API
(/api/v1/...) with an automatically-attached session token. The host
exposes the API base URL via CONFIG_GET so your iframe doesn’t have to
hardcode api.launchmystore.io.
fetch() resolves to the raw Response. fetchJson<T>() parses JSON
and returns the typed body. Token + apiBase are resolved lazily on the
first call and cached.
Intents (INTENT_LAUNCH)
Launch another app’s admin action from inside your own — for example,
chain a “Send invoice” action after editing an order.
<appHandle>.<extensionHandle> — the host resolves
it against the merchant’s registered admin extensions and opens the
matching admin_action modal. Missing targets return { error: '...' }.
Action constants
The SDK does not export a centralisedACTIONS enum — every action name is
a plain string passed to app.dispatch / app.dispatchAndWait. The
canonical source of truth for each name is the corresponding action class
itself:
APP_BRIDGE_FEATURES (exported from the package root) is the one named
constant the SDK ships — a readonly array of PascalCase feature names
('Toast', 'Modal', 'ResourcePicker', …). Use it with the local
Features helper:
app.dispatch(name, ...)
directly. Action names are case-sensitive and the host silently ignores
unknown names, so a typo will surface as a 10-second timeout in
dispatchAndWait. See Error Handling for
the recovery pattern.
See Also
- App Bridge Overview — wire format, security, and SDK initialization
- App Bridge for Checkout — Cart, BuyerJourney, and other checkout-only actions in depth
- Post-Purchase Bridge — action-by-action reference for
host: 'post-purchase'iframes - Error Handling — timeouts, rejections, and per-action failure modes
- React Hooks —
useAppBridge(),useToast(),useResourcePicker(), etc. - Session Tokens — how
app.getSessionToken()works