Developers

Bluemint Search
for your website

One script tag adds a search and a chat to your own website, both answering from your bluemint catalogue.

Script

https://bluemint.app/s/v1.js

Watch first

1

Add your domain

In Bluemint Search settings, under Domains.

2

Paste one line

Before </body> on every page. It has your key in it.

3

Open your site once

The settings screen then says Installed.

01

What it is

One script tag adds a search and a chat to your website, both answering from your bluemint catalogue.

Shoppers type what they need and see matching products from your shop, with photo, price and a link to the product page.

  • Search. A results panel opens under your own search box, or behind a button if your site has none. Up to 8 products per search.
  • Chat. When chat is switched on for your shop, shoppers can also ask questions in a chat on your site. We switch chat on per shop.
  • Stats. The settings screen shows searches, clicks, Messenger handoffs and orders from search for the last 7 days, and the top searches with no result.
02

Turn it on

Two things in your dashboard: add your domain, then copy your line.

Where
Chats & AI › AI settings › Bluemint Search (/dashboard/settings/website-search). Only owners and admins see it.
Not in your menu?
Bluemint Search isn’t switched on for your shop yet. Ask us and we turn it on.
Domains
Under Domains, add the address people type, like jtctl.com. https only (http works only for localhost while you test). The www and non-www versions both work. Up to 10.
Your line
Under Install, tap Copy. The line already has your key in it.
03

Install

Paste one line before the closing body tag of every page.

Your line (copy the real one from Install)
<script src="https://bluemint.app/s/v1.js" data-shop="pk_your_public_key" async></script>
Any site
Just before </body>.
Next.js
In app/layout.tsx, inside <body>. A plain <script … async /> tag works; it’s how bluemint.app loads it.
Laravel
Your main Blade layout.
WordPress
A header and footer plugin.
Google Tag Manager
A Custom HTML tag.
Next.js
// app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <script src="https://bluemint.app/s/v1.js" data-shop="pk_your_public_key" async />
      </body>
    </html>
  );
}

The two attributes

data-shop
Required. Your public key, pk_…. Without it the script stops.
data-api
Optional. The address the widget talks to. It defaults to the address the script was loaded from. Leave it out unless we ask you to set it.

Check it works

  • Open your site once after pasting. The Install card then says Installed on your domain. Until then it says “Not seen yet”.
  • Loaded twice by mistake? The second copy does nothing.
  • The script loads async and never blocks your page. If bluemint can’t be reached, your page stays as it was.
04

Look and behaviour

Choose how shoppers reach the search, and what it says.

How the search shows up

Auto
Uses your search box if it finds one, otherwise shows a button.
Use my search box
Opens the results under your own search box when shoppers tap into it.
Show a button
Adds a search button instead of using your box.
Chat only
No search at all, and your own search box is left alone. Shoppers see just the chat button.

Auto looks for input[type="search"], then an input named q, s, search, keyword or query, then [role="searchbox"]. If it picks the wrong box, put your box’s CSS selector in Look › Advanced. A selector that matches nothing is ignored.

When results are showing, pressing Enter keeps the shopper in the results. Otherwise your own search runs as usual.

Colours and words

Button label
Up to 40 characters. Empty means “Find the right one” in English or “সঠিকটা খুঁজুন” in Bangla.
Accent colour
The widget takes its colours from your site. Set an accent colour to choose the highlight yourself.
Language
Bangla or English, for everything shoppers read in the search and the chat.
Greeting
The first line of the chat. Up to 80 characters, no HTML.
Launcher prompt
With Change the launcher prompt as visitors scroll on, the chat button’s prompt follows the part of the page a visitor is looking at. Off, it always reads your greeting.
Search box text
The placeholder (up to 60 characters) and up to 3 example searches (up to 50 each). Save it (সংরক্ষণ), then turn it on (চালু করুন); those two buttons are in Bangla. Until then shoppers see the default text.

Chat button

Shown in settings once chat is switched on for your shop.

Floating button
A small assistant at the bottom right of every page.
Open on desktop
The chat opens by itself once per visit on screens at least 1200px wide. Phones get the button.
Search box only
The chat appears only inside the search results.

A shopper who closes the chat button doesn’t see it again for the rest of that visit.

05

JavaScript

Your pages can open the search, open the chat, report orders and say who is signed in.

The script adds window.BluemintSearch. The older name window.JhapiSearch is the same object.

open(query?)
Opens the search panel, with the query filled in if you pass one. In Chat only mode it opens the chat. Does nothing until the widget has loaded its settings, or while the chat is open.
chat(query?)
Opens the chat. Only there when chat is switched on for your shop, after the widget has loaded.
order(order)
Reports an order (below).
identify(identity, signature)
Tells us who is signed in. See Visitor identity.
reset()
Call it on logout. It forgets the visitor and starts a fresh anonymous one.
Open the search or the chat
// Open the search with a query (in Chat only mode this opens the chat)
window.BluemintSearch && window.BluemintSearch.open("red saree");

// Open the chat (there only when chat is switched on for your shop)
window.BluemintSearch && window.BluemintSearch.chat && window.BluemintSearch.chat("Do you deliver to Sylhet?");

Report orders

Call order on your order confirmation page. Settings then counts it under Orders from search when the same visitor tapped a search result in the 7 days before.

Order confirmation page
// On your order confirmation page
window.BluemintSearch && window.BluemintSearch.order({
  id: "WEB-10421",                       // your order number
  total: 2450,                           // in taka
  items: [{ id: "SKU-TEE-RED-M", qty: 1 }], // optional
});
id
Your order number. Required, up to 80 characters.
total
The order total in taka. Not negative.
items
Optional. Up to 100 of { id, qty }: your product id (up to 64 characters) and a whole quantity from 1 to 1000. If any value is out of range, the whole order report is dropped.
06

What shoppers see

A fast answer from your own products, and a person when it can’t help.

  • As they type, a results panel shows matching products: photo, name and price in taka. A product with several prices shows a starting price.
  • Tapping a result opens that product’s page on your site. A product with no page link sends them to your Messenger instead, with their search attached.
  • If your shop’s Facebook Page is connected, the results panel has an Ask on Messenger button that carries the search over to your Messenger. When nothing matches, the panel says so and the button is still there.
  • On phones the results open as a full-width sheet; on wider screens, as a dropdown under the search box.
  • The chat (when it’s on) opens from the chat button or from the results, in the language you picked, with your greeting.
07

Your catalogue

Search only shows products that are on sale in your bluemint shop.

  • Products that are switched off, and packaging items, never show.
  • Name, photo and price come from the product in bluemint. Change them there and search follows within about a minute.
  • A budget with no product words, like “under 1500”, shows up to 8 products at or under it, highest price first and in stock first. If nothing is that cheap, it shows the 3 closest above the budget and says they are over it.

Product page links

Results open a product’s page only if bluemint knows its link. In Product pages on the settings screen, paste each product’s address, or tap Find links on my site to get suggestions. Products that are synced from your website already have their link and show “Synced from your website”.

08

Visitor identity

Optional: let the chat know which of your customers is signed in.

In the Visitor identity card on the settings screen. It shows On or Off; if it’s off, ask us to switch it on.

  • Ask for a phone number. The assistant asks once, only when the visitor looks like a real buyer: after the number of visits, chat messages or price hesitations you choose, and if you tick it, when they say they want to order.
  • Account linking. Generate a secret, keep it on your server, and sign who is logged in on every page render. The secret is shown once. Rotating gives a new one; the old one keeps working for 24 hours.
Signed text
v1, id, phone, email and iat, joined with a newline.
phone
Digits only, with a leading 0 turned into 880. Empty if none.
email
Trimmed and lower case. Empty if none.
iat
Unix seconds, now. A signature is accepted for one hour, so sign on every render.
Signature
Hex HMAC-SHA256 of the signed text, with your secret.
Next.js (Laravel and WordPress versions are on the settings screen)
// app/components/JhapiIdentity.tsx  (server component, render it in app/layout.tsx for logged-in users)
// Put the secret from Chats & AI › AI settings › Bluemint Search › Visitor identity in JHAPI_IDENTITY_SECRET (server env only).
import { createHmac } from "node:crypto";
import { getCurrentUser } from "@/lib/session"; // your own helper

export default async function JhapiIdentity() {
  const user = await getCurrentUser();
  if (!user) return null;
  const phone = String(user.phone ?? "").replace(/\D/g, "").replace(/^0/, "880");
  const email = String(user.email ?? "").trim().toLowerCase();
  const iat = Math.floor(Date.now() / 1000);
  const signature = createHmac("sha256", process.env.JHAPI_IDENTITY_SECRET!)
    .update(["v1", String(user.id), phone, email, String(iat)].join("\n"))
    .digest("hex");
  const identity = { id: String(user.id), name: user.name, phone: user.phone ?? undefined, email: user.email ?? undefined, iat };
  const json = (v: unknown) => JSON.stringify(v).replace(/</g, "\\u003c");
  return (
    <script
      dangerouslySetInnerHTML={{
        __html: `window.addEventListener("load",function(){window.BluemintSearch&&window.BluemintSearch.identify(${json(identity)},${json(signature)});});`,
      }}
    />
  );
}

// On logout (before you navigate away): window.BluemintSearch && window.BluemintSearch.reset();
09

Privacy

What the widget keeps in the browser, and what we keep.

Cookies
The widget sends no cookies to bluemint.
Visitor id
A random id in localStorage (jhapi_vid), so a returning visitor’s searches and chat stay together.
Chat session
Once a visitor opens the chat, a session token in localStorage (jhapi.chat.<key>).
Chat button
Whether the visitor closed the chat button, or it already opened by itself, in sessionStorage for that visit.
Page context
While chat is on, the widget tells us which page and products the visitor is looking at, so the chat can help with what’s on screen. Set localStorage jhapi:noSense to any value to turn that off in a browser.
What we keep
Searches, clicks, Messenger handoffs and orders, for 90 days, then deleted.
Identity
Only what your server signs, or a phone number the visitor types in the chat.

Customers can ask for their data to be deleted: Data deletion.

10

Troubleshooting

Most problems are a missing domain or a search box the widget can’t find.

Nothing shows at all
Check your domain is under Domains, exactly as people type it. In your browser’s developer tools, the request to /api/public/site/v1/config says why: 403 origin_not_allowed (domain not listed), 404 unknown_key (wrong key) or 404 not_enabled (not switched on for your shop).
A button instead of my search box
Auto didn’t find your box. Pick Use my search box and set its CSS selector under Advanced.
Still “Not seen yet”
Open a page of your site that has the line, on a listed domain.
Your site has a Content Security Policy
Allow the address in your line (for example https://bluemint.app) in script-src and connect-src.
No chat button
Chat isn’t switched on for your shop, the chat button is set to Search box only, or the visitor closed it during this visit.
Results don’t open my product pages
Add the links under Product pages.
429 rate_limited
Too many searches from one address in a short time. Wait for the Retry-After seconds.