forkable-worker is a TypeScript Notion Worker that turns Forkable lunch ordering into worker tools. It authenticates to Forkable with your session cookie, reads the available menus for a date, shows your current order, and can place or replace a meal order on your behalf.
- Expose
getRestaurantsAndMealsForDateto list every orderable meal for aYYYY-MM-DDdate, grouped by delivery location and restaurant. - Expose
getCurrentOrderForDateto show your current order for a date, optionally narrowed to one location. - Expose
orderMealForDateto place or replace an editable order by exactmealId+menuIdor by a meal-name search. - Validate date format, location filters, ambiguous meal matches, and required Forkable modifier selections before sending an order.
- Return structured results that are suitable for a Notion worker tool surface.
src/index.tsregisters the worker and its three public tools.src/forkable.tswraps the Forkable GraphQL API and contains the matching, validation, and order-submission logic.src/forkable.test.tscovers the main behavior: menu listing, current-order lookup, exact ordering, ambiguity handling, and required selection validation.
The worker authenticates by sending your Forkable _easyorder_session cookie as the value of FORKABLE_SESSION_COOKIE. The worker acts as the Forkable user tied to that session.
Input:
{
"date": "2026-03-25"
}What it returns:
- Deliveries for that date.
- Each delivery's location metadata.
- Restaurants and meals available at that location.
- Meal list entries that include exact
mealIdandmenuId, which are the safest identifiers to use when ordering.
Input:
{
"date": "2026-03-25",
"locationId": null,
"locationName": null
}What it returns:
- Your current order, if any, for each delivery on that date.
- The delivery location and address.
- Chosen selections and any special instructions on the existing order.
Input:
{
"date": "2026-03-25",
"mealName": null,
"mealId": 501,
"menuId": 10,
"restaurantName": null,
"locationId": 3916,
"locationName": null,
"instructions": "No onions",
"selections": [
{ "modifier": "Choose Side", "option": "Salad" }
]
}Behavior:
- Prefers exact
mealId+menuIdordering. - Supports
mealNamesubstring matching when exact IDs are not known. - Lets you narrow matches with
restaurantName,locationId, orlocationName. - Orders only editable deliveries.
- Replaces an existing order for the same delivery if one already exists.
- Fails with a clear error when multiple meals match or when required modifier selections are missing.
Prerequisites:
- Node.js
>=22 - npm
>=10.9.2 - A Forkable account with an active session
Install dependencies:
npm installCreate a local .env file:
FORKABLE_SESSION_COOKIE=your_easyorder_session_cookie_valueImportant:
- Use only the cookie value, not the entire
Cookie:header. - Do not commit this value.
- If the session expires, the worker will stop working until you refresh the cookie.
Validate the repo:
npm run check
npm test
npm run buildThe compiled worker is emitted to dist/.
This repo does not currently include checked-in deployment config or a deploy script. To deploy your own copy, you need to add your own worker config and secrets.
These files are intentionally gitignored, so you create them locally with your own IDs:
workers.json
{
"version": "1",
"environment": "dev",
"workspaceId": "your-workspace-id"
}What you need to supply:
workspaceId: the Notion workspace where this worker will live.workerId: the production worker identifier for your deployed worker.
You need to provide FORKABLE_SESSION_COOKIE in both places:
- Your local
.envfor development. - Your deployed worker environment or secret store.
Without that secret, the worker cannot authenticate to Forkable.
The repo currently only ships:
npm run buildnpm run checknpm test
If you want one-command deployment, add the scripts or CLI integration that match your Notion Workers environment. This repo assumes you already have a Notion Workers deployment path and just need the worker source, config files, and secret values.
If you want to make this worker your own, the usual changes are:
- Rename or extend tools in
src/index.ts. - Add new Forkable GraphQL queries or mutations in
src/forkable.ts. - Add tests in
src/forkable.test.tsbefore changing order logic.