Quickstart: the AI waiter in your app in five minutes
Add Tamr's AI waiter to a web, React Native, Flutter, iOS or Android app in five minutes: get a test key, install the SDK, open the waiter, then sign diners in.
Get a test key, install the SDK for your platform, and open the waiter. Pick your platform once in any tab below and every page of these docs follows it.
1. Get a test key
In the restaurant's Tamr dashboard, Settings > Install the SDK > Try it makes a test key in guest mode that lasts two hours, so the waiter opens without a backend. Or ask the restaurant for a test key from Settings > App keys: a tamr_pk_test_… key, its restaurant address, and, on the web, your site's origin listed on the key (http://localhost:<port> works for a test key).
To work in the dashboard yourself, ask the restaurant to invite you with the Developer role. It opens Install the SDK, App keys, webhooks, External ids, Waiter in your app, the host simulator and API keys for the SDK, and nothing else: no menus, staff or billing.
2. Install the SDK
npm install @tamr/waiter-webnpx expo install @tamr/waiter-react-native react-native-webview expo-web-browser # Expo
npm install @tamr/waiter-react-native react-native-webview # bare React Nativeflutter pub add tamr_waiter.package(url: "https://github.com/abiroot/tamr-waiter-ios", from: "1.2.0"),
// and in your target's dependencies:
.product(name: "TamrWaiter", package: "tamr-waiter-ios"),dependencies {
implementation("link.tamr:waiter-android:1.2.0")
// For the Compose sheet and full screen:
implementation("link.tamr:waiter-android-compose:1.2.0")
}Each platform has a little more setup (a CocoaPods install, the Android Gradle Plugin version, microphone permissions for voice notes). Its page in SDKs lists it.
3. Open the waiter
Replace tamr_pk_test_… with your key and your-restaurant with the restaurant's address. myBackend.tamrToken() stands for your own call to your backend, which signs a diner token; with a guest key you can return "no one" for now.
import { createWaiter } from "@tamr/waiter-web";
const waiter = createWaiter({
key: "tamr_pk_test_…",
restaurant: "your-restaurant",
mount: { kind: "launcher", position: "right" }, // or { kind: "sheet" }, or { kind: "inline", container }
locale: "ar", // optional: branch, appearance, table, tableScan, mode, debug, onLog, title
});
// Who the diner is, asked whenever the page needs a fresh token. Return null for "no one".
waiter.setIdentityProvider(async (reason) => {
const res = await fetch("/api/tamr-token"); // your backend signs it
return res.ok ? { token: await res.text() } : null;
});
// Orders go to your own cart ("Orders go to: the app's cart"): answer each line.
waiter.onCartAdd(async ({ lines }) => ({ ok: true, lines: lines.map((l) => ({ lineId: l.lineId, ok: true })) }));
// Everything the page tells you, typed.
waiter.on("order.placed", (order) => console.log("order", order.orderId));
waiter.on("payment.completed", (payment) => console.log("paid", payment.paymentId));
waiter.open(); // also: close(), preload(), destroy()
waiter.setLocale("fr"); // also: setAppearance, setText, setTheme, setContext, setStarters, setRestrictions, setGoal
waiter.chat.send("What's good tonight?");import { useEffect, useState } from "react";
import { Button } from "react-native";
import { SafeAreaProvider, useSafeAreaInsets } from "react-native-safe-area-context";
import { createWaiter, TamrWaiterHost, type Waiter } from "@tamr/waiter-react-native";
const waiter = createWaiter({
key: "tamr_pk_test_…",
restaurant: "your-restaurant",
locale: "ar", // optional: branch, appearance, table, tableScan, mode, launch, debug, onLog
});
// Who the diner is, asked whenever the page needs a fresh token. Return null for "no one".
waiter.setIdentityProvider(async () => {
const token = await myBackend.tamrToken(); // your backend signs it
return token ? { token } : null;
});
// Orders go to your own cart ("Orders go to: the app's cart"): answer each line.
waiter.onCartAdd(async (change) => ({
ok: true,
lines: change.lines.map((line) => ({ lineId: line.lineId, ok: true })),
}));
// Everything the page tells you.
waiter.on("payment.completed", (paid) => console.log("paid", paid.paymentId));
export function App() {
return (
<SafeAreaProvider>
<Root />
</SafeAreaProvider>
);
}
function Root() {
return (
<>
<Navigator />
{/* After your screens, so it covers them. */}
<TamrWaiterHost waiter={waiter} insets={useSafeAreaInsets()} />
</>
);
}
function MenuScreen() {
useEffect(() => waiter.preload(), []);
return <Button title="Ask the waiter" onPress={waiter.open} />;
}import 'package:tamr_waiter/tamr_waiter.dart';
final waiter = TamrWaiterController(
appKey: 'tamr_pk_test_…',
restaurant: 'your-restaurant',
locale: 'ar', // optional: branch, appearance, table, tableScan, mode, debug, onLog
)..preload();
// Who the diner is, asked whenever the page needs a fresh token. Return null for "no one".
waiter.setIdentityProvider((reason) async {
final token = await myBackend.tamrToken(); // your backend signs it
return token == null ? null : TamrToken(token);
});
// Orders go to your own cart ("Orders go to: the app's cart"): answer each line.
waiter.onCartAdd((change) async => Reply(ok: true, lines: [
for (final line in change.lines) LineAnswer(lineId: line.lineId, ok: true),
]));
// Everything the page tells you.
waiter.on('payment.completed', (message) {
final paid = (message as PaymentCompletedMessage).data;
print('paid ${paid.paymentId}');
});
// On a tap:
TamrWaiterSheet.show(context, controller: waiter);import TamrWaiter
let waiter = try TamrWaiterController(
appKey: "tamr_pk_test_…",
restaurant: "your-restaurant",
locale: "ar" // optional: branch, appearance, table, tableScan, mode, launch, debug, onLog
)
waiter.preload()
// Who the diner is, asked whenever the page needs a fresh token. Return nil for "no one".
waiter.setIdentityProvider { _ in
guard let token = try await myBackend.tamrToken() else { return nil } // your backend signs it
return .token(token)
}
// Orders go to your own cart ("Orders go to: the app's cart"): answer each line.
waiter.onCartAdd { change in
Reply(ok: true, lines: change.lines.map { LineAnswer(lineId: $0.lineId, ok: true) })
}
// Everything the page tells you.
waiter.on("payment.completed") { message in
if let paid = message as? PaymentCompletedMessage { print("paid", paid.data.paymentId) }
}
// On a tap, UIKit:
present(TamrWaiterViewController(controller: waiter), animated: true)
// or SwiftUI:
.sheet(isPresented: $open) { TamrWaiterView(controller: waiter) }class MenuViewModel(app: Application) : AndroidViewModel(app) {
val waiter = TamrWaiterController(
context = app,
appKey = "tamr_pk_test_…",
restaurant = "your-restaurant",
locale = "ar", // optional: branch, appearance, table, tableScan, mode, launch, host, debug, onLog
).apply {
// Who the diner is, asked whenever the page needs a fresh token. Return null for "no one".
setIdentityProvider { myBackend.tamrToken()?.let(TamrIdentity::token) }
// Orders go to your own cart ("Orders go to: the app's cart"): answer each line.
onCartAdd { change -> Reply(ok = true, lines = change.lines.map { LineAnswer(it.lineId, ok = true) }) }
// Everything the page tells you.
on("payment.completed") { (it as? PaymentCompletedMessage)?.let { paid -> log(paid.data.paymentId) } }
}
override fun onCleared() = waiter.dispose()
}
// In the Activity: model.waiter.preload() in onResume.
// Compose: the open state in rememberSaveable, so a rotation or process death keeps it.
var open by rememberSaveable { mutableStateOf(false) }
if (open) TamrWaiterSheet(model.waiter, onDismiss = { open = false })
// Views:
findViewById<TamrWaiterView>(R.id.waiter).attach(model.waiter)Run your app and tap the button: the waiter opens with the restaurant's menu and a "Test mode" label.
4. Sign diners in
A live key usually has no guest mode, so your backend signs a short token for each signed-in user and your identity provider returns it. That takes one function on your server: Diner identity has it in Node, Kotlin, Dart and Swift.