Skip to content
ReppREST reference · v2

Partner quickstart

The messenger in your product in five steps: keys, one server endpoint, the script, your own buttons if you want them, and blocking booked rooms from webhooks.

1. Get your keys

You get two keys from Repp. The publishable key (rpk_test_…) goes in your page; it only says who you are. The secret key (rsk_test_…) stays on your server; it makes sessions. Test keys are all there is in early access. See Authentication & keys.

Your server's environment
export REPP_SECRET_KEY="rsk_test_…"

2. Make sessions on your server

Add one endpoint to your server that your page calls. It works out the business and the person from your own sign-in, builds the session's body from your own data, calls Sessions, and answers the client_secret alone.

Your endpoint (Node)
// Your server (Node 18+ with Express): a session for the person signed in to your system.
const COMPONENTS = ["messenger", "connect", "substitute", "class-status"];

app.post("/repp/session", requireSignedIn, async (req, res) => {
  const { component, classId } = req.body; // what the SDK asked for
  if (!COMPONENTS.includes(component)) return res.status(400).end();
  const business = req.user.business; // never a business id sent by the browser

  const body = {
    partner_business_id: String(business.id),
    partner_business_name: business.name,
    partner_user: { id: String(req.user.id), role: roleInRepp(req.user), display_name: req.user.firstName },
    component,
    class: null,
  };
  if (component === "messenger") {
    // From your own data: the next ~14 days of classes (up to 100) and the rooms (up to 50).
    body.classes = await comingClasses(business, { days: 14, max: 100 });
    body.rooms = await roomsOf(business, { max: 50 });
  } else if (component !== "connect") {
    // One of this business's classes, or nothing.
    body.class = await classSnapshot(business, classId);
    if (!body.class) return res.status(404).end();
  }

  const response = await fetch("https://api.dev.repp.co.il/partner/v1/embed-sessions", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.REPP_SECRET_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(body),
  });
  if (!response.ok) return res.status(502).end();
  const { client_secret } = await response.json();
  res.json({ client_secret }); // the secret alone: never your key, never the whole answer
});

The call to Repp itself, in every language:

curl -X POST "https://api.dev.repp.co.il/partner/v1/embed-sessions" \
  -H "Authorization: Bearer $REPP_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "partner_business_id": "4012",
  "partner_business_name": "סטודיו מרכז",
  "partner_user": {
    "id": "51751",
    "role": "manager",
    "display_name": "מיכל"
  },
  "component": "messenger",
  "class": null,
  "classes": [
    {
      "partner_class_id": "30146899",
      "date": "2026-12-07",
      "time": "18:00",
      "duration_minutes": 60,
      "style": "pilates",
      "service_name": "פילאטיס מכשירים",
      "branch_name": "סניף ראשי"
    }
  ],
  "rooms": [
    {
      "partner_room_id": "room-2",
      "name": "סטודיו גדול",
      "branch_name": "סניף ראשי",
      "capacity": 20
    }
  ]
}'

3. Load the script and boot the messenger

Your page
<script src="https://embed.dev.repp.co.il/v1/repp-embed.js"></script>
After the script loads
const repp = await ReppEmbed.load({
  publishableKey: "rpk_test_…",
  // Called for every frame Repp loads, and again when a session runs out.
  fetchClientSecret: async ({ component, classId }) => {
    const response = await fetch("/repp/session", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ component, classId }),
    });
    if (!response.ok) throw new Error("No Repp session");
    return (await response.json()).client_secret;
  },
});

const messenger = repp.boot({ alignment: "left" });

The button appears in the bottom left corner, and the panel loads hidden behind it, so its count is live and it opens at once. See the Messenger SDK for every option.

4. Open it from your own buttons (optional)

Your calendar and menus can open the panel right where the business needs it: on one class, or on the rooms for rent.

Your buttons
// "Find a substitute trainer" on a class in your own calendar:
findButton.addEventListener("click", () => messenger.showSubstitute("30146899"));

// "Rent out a room" in your own menu:
rentButton.addEventListener("click", () => messenger.showSpace("spaces"));

5. Block rooms that were booked

When a trainer books a room the business opened from the panel, your calendar should hold that room for those hours. Do it from Webhooks on your server: room.booking_requested, room.booking_confirmed and room.booking_cancelled reach you whether or not anyone has your page open, signed, and retried until you answer. Set your endpoint once with your secret key.

Your page hears the same while the messenger is booted, so an open calendar can update at once: when it boots it first says each room's whole window (room_bookings), then each change (room_booking_changed).

Room bookings in an open page
// One block per booking and day (a weekly booking holds the room on several days).
const blockId = (room, booking) => `repp:${room}:${booking.repp_booking_id}:${booking.date}`;
const block = (room, booking) =>
  calendar.blockRoom(room, blockId(room, booking), {
    date: booking.date,
    from: booking.start_hour,
    to: booking.end_hour,
    tentative: booking.state === "pending",
  });

// When the messenger boots, and each new day: the room's whole window. Replace your Repp blocks of that room
// in those days, so whatever changed while your page was closed is right too.
messenger.on("room_bookings", ({ partner_room_id, from, to, bookings }) => {
  calendar.removeBlocks(partner_room_id, { prefix: "repp:", from, to });
  for (const booking of bookings) block(partner_room_id, booking);
});

// Between reads: one booking on one day came, was confirmed or went.
messenger.on("room_booking_changed", (booking) => {
  if (booking.state === "cancelled") calendar.removeBlock(blockId(booking.partner_room_id, booking));
  else block(booking.partner_room_id, booking);
});

Browser events reach only a page where the messenger is booted. Keep your record of bookings from Webhooks: they are the source of truth, and the browser's events only a quicker hint.

Signing out
// When the person signs out of your system:
messenger.shutdown();