Keep your app in step with Tamr's menu

Make Tamr the source of truth for your menu and prices: read each menu from your backend, store its version, refresh on the menu.changed webhook and poll as a fallback.

When the restaurant edits its menu in Tamr, your app, your checkout and your other channels should show the same dishes and prices within seconds. Your backend keeps a copy of each menu, and Tamr tells it when to refresh.

1. Make a key that reads the menu

An owner or admin makes a secret key in Settings > API keys with the Menu read (SDK) permission (catalog:read). It can only read menus: give writing ids (catalog:sdk) and orders (orders:sdk) their own keys. Keep it on your server.

2. Read each menu

Call Read a menu from your backend for each branch and service mode you sell in, or once per menu by menu:

Node
import { createServerClient } from "@tamr/api/server";

const tamr = createServerClient({ secretKey: process.env.TAMR_SECRET_KEY });
const { menu, categories } = await tamr.catalogMenu({
  branch: "achrafieh",
  mode: "delivery",
});

Store menu.menuId, menu.version, the ETag header if you call over HTTP yourself, and the dishes. Prices are minor units as strings ("1200" is 12.00): never parse them through a float. Your ids come back on every dish, size and option as externalId, once you have set them.

3. Refresh on menu.changed

Add a webhook endpoint in Settings > App keys > Webhooks that takes menu.changed, and verify every signature. On each event:

  1. Handle each webhook-id once.
  2. Read the menu again by menuId (menu in the query), at the branches you keep it for. Use dishIds to update only those dishes if you like; when it is absent, replace the whole menu.
  3. With published: false, take the menu down on your side.

Answer the webhook with a 2xx before you do the work, or queue it: a slow answer is retried.

4. Poll as a fallback

Webhooks can be late (your endpoint was down, a retry is waiting), so also read each menu every 5 to 15 minutes. Send the stored ETag in If-None-Match: Tamr answers 304 Not Modified with no body while nothing changed, which costs you almost nothing.

curl
curl "https://tamr.link/api/v1/catalog/menu?menu=$MENU_ID" \
  -H "Authorization: Bearer $TAMR_SECRET_KEY" \
  -H 'If-None-Match: "v42-0123456789abcdef"'

version alone moves only with what diners see. The ETag also moves when only your ids or a dish's availability did, so compare the ETag (or the body), not the version, to know whether anything changed.

What stays live

  • Sold out. A dish sold out right now is left out of the menu, as for diners, and comes back when it is on sale again (back_on_sale).
  • Dish hours. A dish on weekly hours (breakfast until 11:00, say) is left out or marked available: false by the clock at the time you read it, and no event is sent when its hours begin or end. Check available when the diner orders, or read the menu again at the times your restaurant's hours change.