Opt-in prompts
Subscribe buttons: the pop-up, after-add-to-cart card, floating bell, exit offer and top bar (PUT /api/v1/prompt), A/B test and the preview link.
Every way visitors can subscribe is set per project, in one place: the dashboard's Audience → Subscribe buttons (each with an on/off switch, its text, a live preview and Reset to recommended), or PUT /api/v1/prompt. The SDK draws them all:
- Subscribe pop-up: the main prompt (
type,trigger,title, …). On by default. - After add to cart (
cartAsk): a small card right after an add to cart. On by default. - Floating bell (
bell): a round bell in a bottom corner of every page. On by default. - Exit offer (
exitOffer): a second chance when a visitor is about to leave. Off by default. - Top bar (
topBar): a slim bar at the top of the page. Off by default.
One ask at a time: at most one automatic ask is on screen. The top bar shows only on page views where the pop-up won't ask (it's off, snoozed by "no", or was already shown this session), and nothing else opens while it's up; the after-add-to-cart card replaces it. The exit offer never opens over another ask, never while the pop-up's 7-day "no" runs, and not when the pop-up's own trigger is exit. Nothing asks when notifications are blocked or the browser can't get them, on cart / checkout / account pages (the bell stays off checkout pages only), or with init({ showPrompt: false }). The bell steps aside while a box is open and disappears once the visitor subscribes or blocks.
Styles: slidein (default; card is the same box), bar, modal, native. Triggers: engaged, delay, load, click, scroll, exit, engaged_or_exit. Add a privacy policy link in Settings → Privacy (it's the privacyUrl setting, not a prompt field) to show it on the prompt. Set a prompt b variant to A/B-test opt-in copy. Visitors who click the “no” button (or click outside a modal) aren't asked again for 7 days.
curl -X PUT https://relaybell.com/api/v1/prompt \
-H "Authorization: Bearer rb_live_xxxxx" -H "Content-Type: application/json" \
-d '{ "prompt": { "type": "slidein", "trigger": "engaged",
"title": "Be the first to know",
"message": "Get first dibs on sales, restocks and price drops, right on your screen. One tap, no email needed.",
"allowText": "Yes, notify me", "denyText": "Maybe later",
"position": "bottom-right", "accentColor": "#0B7C93",
"bell": { "enabled": true, "label": "Get deal alerts" },
"exitOffer": { "enabled": true, "days": 7 },
"topBar": { "enabled": false } } }'| Field | Values |
|---|---|
enabled | Default true. false = the pop-up never asks automatically (the bell, top bar, exit offer and your own button + subscribeNow() still work). |
type | slidein · card (another name for the same slide-in box) · bar · modal · native (browser prompt only — Safari and Firefox only allow it inside a click, so unless the trigger is click their visitors get the slidein box instead). |
trigger | engaged (a product page, a 40% scroll or a 2nd page view, never before 8 s) · delay · load · scroll · exit · engaged_or_exit · click. |
delaySeconds, scrollPercent | For delay (0–600) and scroll (1–100). |
clickSelector | CSS selector of your button, for the click trigger. |
title, message, allowText, denyText | Pop-up copy (longer text is cut to 120 / 300 / 40 / 40 characters). |
position | bottom-right · bottom-left · top-right · top-left (slide-in), top · bottom (bar). |
accentColor | Button color — must be a hex color like #0B7C93; anything else is rejected with 400 invalid_color. |
matchSiteButtons | true: use the colour and corners of your site's main button (accentColor is the fallback). |
iosInstallHint | false hides the iPhone/iPad “Add to Home Screen” how-to. |
cartAsk | { enabled, title, body, button } (up to 80 / 160 / 30 characters). After a “Not now”, not shown again for 7 days. |
bell | { enabled, position, label }. position is bottom-right or bottom-left; left out, the bell takes the bottom corner opposite the pop-up (on the right it sits higher, clear of chat buttons). label is the tooltip and screen-reader name (up to 60 characters). Never on checkout pages. |
exitOffer | { enabled, title, message, allowText, denyText, days } (up to 80 / 200 / 30 / 30 characters). Once a session at most; after it shows, not again for days (1–90, default 7). Its “no” doesn't snooze the pop-up. |
topBar | { enabled, text, button } (up to 100 / 30 characters). Pushes the page down rather than covering your header; its “×” hides it for 14 days. |
b | Version B for an A/B test: { title, message, allowText } (empty fields fall back to version A). |
A touchpoint sent as anything other than an object (or null) is refused with 400 invalid_prompt; a switch is on only for a strict true.
PUT /api/v1/prompt takes the prompt as { "prompt": { … } } (or the fields at the top level) and answers { ok: true, prompt }. It accepts the fields listed above only — anything else is dropped, and an unknown type, trigger or position falls back to slidein, delay or the style's default — and it replaces the whole prompt, so send every field you want to keep. A saved prompt is yours: relaybell never rewrites it.
GET /api/v1/prompt answers { prompt, recommended, kind }: the current prompt, relaybell's recommended copy and switches for every touchpoint (what Reset to recommended uses), and kind — store (a Shopify store, a WooCommerce site or a product catalog) or site, which picks shopping or general wording. A website that never saved its prompt gets the recommended copy for its kind.
Welcome offer: while your welcome offer is on (Automations → Offers) and its codes will be honoured, the SDK's config carries its real line (“Get 10% off your first order”), shown under the pop-up's and the exit offer's message and after the top bar's text. RelayBell.offerLine() resolves it (or null) for your own sign-up boxes.
Preview: open any page of your site with ?rb_preview_prompt=1 (e.g. https://yoursite.com/?rb_preview_prompt=1). The SDK removes the parameter from the address bar and shows your saved pop-up (version A, in a browser that supports push) straight away — ignoring enabled, the 7-day dismissal, the current permission and the trigger. Clicking “no” in preview doesn't record a dismissal. For type: "native" it shows the slide-in card instead, since the browser's own prompt can't be previewed. The dashboard's See the saved version on my website link does exactly this.