Integrate Shopify Inbox with Shopify Hydrogen
Shopify Inbox gives shoppers a chat launcher connected to the Inbox app in Shopify admin. A Hydrogen storefront can load the same storefront chat runtime without depending on a Liquid theme. This guide uses the loader pattern implemented in the Weaverse Pilot theme. It is a working reference, not a required component or stable Shopify API contract.What you will build
Prerequisites
- Shopify Inbox installed for the store.
- Online store chat enabled and configured in the Shopify Inbox app.
- The store’s
myshopify.comdomain. - The Inbox shop ID from the app’s online-store chat configuration.
- A deployed HTTPS environment for final verification.
Create a client-side loader
Shopify’s storefront chat loader reads the store and launcher settings from its own script URL. Load it once, after the page reaches theload state, to avoid duplicate initialization.
The abbreviated query parameters are consumed by Shopify’s chat loader. Treat them and the generated DOM as implementation details that may change; verify the integration whenever Shopify updates Inbox behavior.
Mount Inbox in the Hydrogen root
Render the loader once in the application root so client-side route changes do not create duplicate chat instances.Update the Content Security Policy
A strict CSP must allow Shopify’s loader and chat network requests. Merge these hosts into the existing Hydrogen and Weaverse policy instead of replacing it:* sources.
Handle modals and bottom-sheet overlays
The fixed Inbox launcher can overlap cart drawers, quick-shop dialogs, account modals, or cookie banners. Prefer layout spacing first. If the launcher must be hidden while an overlay is open, isolate that behavior in one utility and restore it when the overlay closes. Do not depend on Shopify’s internal iframe IDs, shadow-DOM selectors, or web-component structure unless you accept that the workaround can break after a vendor update. Shopify does not expose a documented storefront API for pre-filling or sending a message from your custom button.Use Inbox with Weaverse
Keep the global loader in the Hydrogen root. A Weaverse section can expose a merchant-facing “Message us” call to action, but the Inbox runtime itself should not be mounted separately in each section. Recommended Studio settings are presentation-only:- Button label and style.
- Section spacing and colors.
- Whether the call to action is displayed.
Test the integration
- Deploy the storefront to an HTTPS preview or production domain.
- Open the site in a private browser session.
- Confirm the chat launcher appears once.
- Start a conversation and confirm it arrives in Shopify Inbox.
- Navigate between at least three Hydrogen routes and revisit the first route.
- Open and close cart, quick-shop, account, and consent overlays.
- Check the browser console for CSP, duplicate-script, and network errors.
- Verify behavior on mobile and desktop.
Troubleshooting
The launcher does not appear
- Confirm online-store chat is enabled in Shopify Inbox.
- Confirm both public identifiers are present in the deployed environment.
- Check for CSP errors involving
cdn.shopify.comor Shopify service hosts. - Verify on a deployed HTTPS URL instead of localhost.
The launcher appears twice
Mount the loader only in the root and keep a stable script ID. Do not add the same script in both document markup and a React effect.The launcher disappears after initial load
Injecting the loader too early can conflict with its window-load behavior. Wait untildocument.readyState === "complete" or attach a one-time load listener, as shown above.
Chat overlaps another fixed element
Adjust the launcher position in the loader parameters or reserve safe space in the page layout. Use DOM-level hiding only as a documented, tested fallback.Production checklist
- Inbox is enabled for the correct Shopify store.
- Only public Inbox identifiers reach the browser.
- The loader is mounted once in the root.
- CSP allows the minimum required Shopify hosts.
- Overlay and mobile behavior are verified.
- Route changes do not duplicate or remove the widget.
- A real message reaches the Inbox team.