Shopify integration

1. Add the snippet to your layout

Use the async loader from the docs home.

2. Server-side user hash

// Shopify app proxy or theme app extension — server route only
import { createHmac } from "node:crypto";
export function rokochatUserHash(userId: string) {
  return createHmac("sha256", process.env.ROKOCHAT_IDENTITY_SECRET!).update(userId).digest("hex");
}

3. Call identify() in the browser

Rokochat.identify({
  id: user.id,
  user_hash: userHash,
  email: user.email,
  name: user.name,
});
// Liquid + app proxy: pass user_hash from your app backend, never compute in Liquid alone

Always call Rokochat.logout() when the user signs out.