Skip to content

Setup check

The setup check is the one thing the SDK draws: a panel for developers that checks your set-up as the page runs, says what to fix, and has buttons to try each part. It is in English only, and it shows only when you turn it on.

src/crm.ts
export const crm = new Crm({
config: {
apiBase: "https://app.purrcrm.com",
appKey: "app_...",
appVersion: "2.4.0",
debug: !import.meta.env.PROD, // never in what your users get
releaseBuild: import.meta.env.PROD,
},
auth,
host,
});

With debug: true:

  • every request is written to the logger as a line, such as crm-sdk: GET /guest/v1/conversations/… → 200 in 84 ms (req_…): the method, the path with ids left out, the status and PurrCRM‘s code, how long it took, and the request id. Never a token or a body;
  • once the page has loaded, crm.start() loads the setup check and draws its panel.

The panel lives in crm-sdk/debug, which the SDK loads with a dynamic import() only when debug is on, so your bundler puts it in a chunk of its own that a page with debug off never loads. Turn it off in the build your users get: a releaseBuild with debug on writes a warning once, since the panel would show to your users.

The panel draws itself in a Shadow DOM root, so your page’s styles do not reach it, and styles it only through the DOM’s style properties: no <style> element and no style attribute in markup. A Content Security Policy without 'unsafe-inline' in style-src still lets it draw. It needs nothing from script-src beyond your own bundle’s chunks, and nothing from connect-src beyond PurrCRM‘s address, which the SDK needs anyway.

To open it from a hidden developer menu instead, leave debug off and load it yourself:

const { attachSetupCheck } = await import("crm-sdk/debug");
const panel = attachSetupCheck(crm); // the panel already drawn, if there is one
await panel.refresh(); // run the checks again
panel.remove();

gatherFacts(crm), runChecks(facts), tally(checks) and reportText(checks, facts) run the same checks without the panel, for your own tests.

It opens at the foot of the page as a sheet: a row per check, grouped by section, each with a coloured dot and a one-line result. Tap a row for its detail and how to fix it; the fix names the page of these docs that explains it (such as “Docs: Web SDK › Push”) and the place on PurrCRM‘s site. Under the checks are the test actions, each answering in place.

  • Collapse (or Escape) folds it to a small pill, “CRM ● 9/11”: how many checks passed of those that could say, the dot coloured by the worst. Drag the pill anywhere; tap it to open the sheet again.
  • Hide takes the panel away for this load of the page.
DotMeans
GreenFine.
AmberWorks, but something is off or missing.
RedBroken: fix it.
GreyNot checked: skipped, or the page cannot tell yet.

To check, the panel makes two calls of its own: it asks your token source for the user’s token (and reads its claims, never sending or showing the token), and it makes one call as the user, reading their consent, which no part of PurrCRM holds back.

CheckWhat it looks atWhen it is not green
Version and kindThe SDK’s version and kind (web), as every request says them.Always green.
Started and readycrm.start() has answered, and how soon after it the user was ready.Red: start() has not answered; call it once as the page loads (Initialise). Grey while it waits up to 10 seconds for setReady(true); amber after that, or when the user was ready more than 10 seconds after start. Nothing of PurrCRM‘s shows, and no link or tapped push is followed, until setReady(true).
Lifecycle followedThe page being hidden and shown is followed, and how often it was.Amber: followLifecycle is off, so events are not sent as the page is hidden; leave it on outside tests. Grey until you switch to another tab and back.
CheckWhat it looks atWhen it is not green
Server reachableReading the app’s public face from apiBase, and how long it took.Red with no app key: set appKey. Red when PurrCRM could not be reached or did not answer in time: check apiBase, and that this page’s site is in Web origins, since a browser makes a refused origin look like no network (Install). An https page cannot call an http address either, and the row says so. Red for any other answer. Grey while it asks.
App key and modeThe key is an app’s, and whether it is live or test, with the app’s name.Red: PurrCRM knows no app by that key; copy it from the App key card. Amber: a test key in a releaseBuild (Test mode).
FeaturesWhich of the messenger, the help center and in-app messages the app has on.Amber, naming those that are off: switch them on under Settings › your app › General, on the Name and features card, if the app uses them.
CheckWhat it looks atWhen it is not green
Sign-in modeTokens, or unverified sign-in.Amber for unverified sign-in: anyone can pretend to be anyone. Sign users in with tokens (Sign users in).
TokenThe token your source answers for the user: its algorithm, sub, exp and iat.Red: the source answered none, or failed; it has no sub, or a sub that is not the session’s guestId; it has no exp, has expired, or is HS256 with an exp more than 30 days ahead. Amber: no iat, or an iat in the future, which means this device’s clock is behind. Grey for nobody signed in, unverified sign-in, or a token that is not a JWT (which PurrCRM may still take: the next row says).
Guest callOne call as the user, and how long it took.Red with 401 and PurrCRM‘s code: it refused the token, and the detail says why (When a user is refused). Red when it could not be reached: most often the page’s site is not in Web origins. Grey for nobody signed in.
Sessioncrm.session named a user, and whether they turned product events off.Amber: nobody signed in. Call crm.session({ guestId }) once your own sign-in has settled.
CheckWhat it looks atWhen it is not green
QueueHow many events wait, the last send (accepted and rejected), and the next try after a failure.Amber: sends are failing, or some events were rejected; declare your own names in customEvents and on PurrCRM (Events). Grey for nobody signed in, or a user who turned product events off.
CheckWhat it looks atWhen it is not green
PermissionThe browser’s Notification.permission.Amber: denied, the user turned notifications off for this site in the browser. Grey: not asked yet (ask from a tap, and tell crm.permissionChanged), or this browser has no notifications here (web push needs a secure context and a browser that supports it).
Token registeredYour app handed the SDK a push token, and PurrCRM took it for the user.Red with the reason PurrCRM gave. Grey: registerPushToken not called, or waiting for a user to sign in (Push).
Handler wiredhandlePushArrival or handlePushTap has been called: on this load, or for one of PurrCRM‘s pushes at any time in this browser.Amber until one is seen: forward pushes and taps from your service worker to the page (Push).
CheckWhat it looks atWhen it is not green
Link hostThe app’s link base.Amber: none, so links live only under /l/<the app's link name>/ on PurrCRM‘s host; set the links up under Links › Setup (Links).
Web originThis page’s origin, and whether it is a secure context.Red: requests from this origin fail, most often because it is not in Web origins. Amber: not a secure context, so there is no WebCrypto (your places are not declared) and no web push; serve the page over https.
Declared linksThe places in CrmHost.links, each path checked, and their digest.Red: some paths are not valid, each named with why. Amber: no digest, since the page cannot make one, so they are not sent. Grey: none declared (Declare your places).
CheckWhat it looks atWhen it is not green
Navigation hooksnavigate, openInApp and followable are handed in, and something subscribes to crm.inApp.next.Amber, naming the hooks missing, or that nothing draws in-app messages (Initialise, In-app messages).
CheckWhat it looks atWhen it is not green
Store worksThe store keeps what it is given, and whether it is localStorage.Red: the store does not keep what it is given; check your store. Amber: localStorage is blocked (a private window, blocked site data, a sandboxed frame), so everything is in memory and waiting events are lost when the page goes.
ActionWhat it does
Run checks againGathers the facts again and redraws every row.
Send a test eventRecords screen_viewed with screen: crm_setup_check, sends the queue at once, and says how many PurrCRM accepted and what it rejected. The user’s activity in PurrCRM then shows the screen view.
Check in nowChecks in for in-app messages whatever the hint, and says how many tests arrived, whether this user is a test phone, what waits and what shows, and why nothing shows if the user is not ready or nothing draws crm.inApp.next.
Open messengerOpens the messenger through your navigate hook, and says whether it answered true.
Open help centerThe same for the help center.
Copy guest idCopies the user’s id, for Testing › Preview on my phone and the contact’s page. Where the clipboard is refused, it shows the id.
Test a pushRegisters the push token again for the user and says whether PurrCRM took it. Then push to this browser with Push my phones, on the Send a test push card of Settings › your app › Delivery › Push, with this browser one of your test phones: the Handler wired row turns green when it arrives through handlePushArrival.
Test linksMakes a share link to /messages (with the data setup_check: 1, on the channel setup_check, so it counts as a user’s link), and lists its full address, its short /go/ address, and <link base>/messages. Each has Share (the browser’s share sheet, else the clipboard), to try it on another device (in a browser it goes through PurrCRM to its web page, where handleLink takes /messages if your site serves that path), and Open here, which hands it to handleLink and says what linkOpened heard and where navigate or openInApp went.
Export reportPuts the report on the clipboard, or saves it as crm-setup-check.txt.

The report is plain text to paste into a ticket or a chat with whoever helps you: the time, the SDK’s kind and version, your app’s version, apiBase and app key, the page’s origin and the browser’s user agent, then every check with its status, its detail, and how to fix it when it is not green. It holds no token and no request body.

crm-sdk setup check, 2026-10-28T09:30:00.000Z
SDK web 0.3.0; app version 2.4.0; API https://…; key app_test_…
Page https://staging.northwind.example; Mozilla/5.0 …
[OK ] SDK / Version and kind: crm-sdk 0.3.0 (web)
[OK ] SDK / Started and ready: ready 0.4 s after start
[WARN] Pushes / Handler wired: not seen yet
Fix: Forward payload.data from your Firebase service worker with postMessage to crm.handlePushArrival, …