Skip to content

Build with AI

Paste one of these prompts into your AI coding assistant (ChatGPT, Claude, Gemini, GitHub Copilot, Cursor…), together with your website’s code, and it will build the integration. Use the copy button at the top right of each prompt.

  1. Create a publishable key in ALWS RESTRO (Account Setting → API Keys) with your website’s address as an allowed website. Create a secret key too if your site has a server and you want online payments.
  2. Pick the prompt that matches your website below and replace the parts in [square brackets].
  3. Review what the AI writes, test it with a real order, and then cancel the test order in ALWS RESTRO.

Online ordering (pay at pickup or cash on delivery), order tracking and table booking, with no server code.

You are adding online ordering and table booking to my restaurant website using the ALWS RESTRO Restaurants API.
MY WEBSITE
- Type: [static HTML/CSS/JavaScript | React | Vue | other: ___]
- Pages/files to change: [list them, or say "create new pages"]
- Style: match the existing design (fonts, colours, buttons).
API FACTS (follow exactly)
- Base URL: https://restro.alws.in/api/v1
- Auth header on every request: Authorization: Bearer [pk_live_PASTE_PUBLISHABLE_KEY]
This is a publishable key: it is safe in browser code and only works on my allowed website.
- JSON in and out. Money is INR. Times are India Standard Time.
- Full contract (read it if you can browse): https://developers.alws.in/restaurants/openapi.json
- GET /menu -> { currency, categories:[{name,itemCount}], items:[{id,name,category,price,foodType:"veg"|"egg"|"nonveg"|null}] }
- POST /orders/quote body { items:[{itemId,quantity}], couponCode? }
-> { items:[{itemId,name,unitPrice,quantity,lineTotal}], subtotal, discount|null, charges:[{name,percentage,amount}], roundOff, total }
- POST /orders body { items, orderType:"pickup"|"delivery", customer:{name,phone,email?},
deliveryAddress?:{line,landmark?,city?,pincode?} (required for delivery), notes?, couponCode?,
payment:{method:"cash"}, expectedTotal:<quote.total> }
Header Idempotency-Key: a new crypto.randomUUID() per order, reused on retries of the same order.
-> 201 { id, orderNumber, status, statusText, total, ..., accessToken }
- GET /orders/{id} with header X-Order-Token:<accessToken> -> current status/statusText.
Statuses: pending, processing, shipped, delivered, cancelled.
- POST /orders/{id}/cancel with X-Order-Token (only works while status is pending).
- GET /reservations/availability?date=YYYY-MM-DD&from=HH:mm&to=HH:mm -> { availableCount, tables:[{tableId,tableNumber,floorName,available}] }
- POST /reservations body { date, from, to, partySize?, customer:{name,phone,email?}, notes?, tableId? }
Header Idempotency-Key. -> 201 { id, table:{tableNumber}, date, from, to, accessToken }
- POST /reservations/{id}/cancel with header X-Reservation-Token:<accessToken>
- Errors: { error:{ code, message, requestId, details? } }. Show error.message to the user.
409 price_changed -> show details.quote.total and ask the customer to confirm again.
422 item_unavailable / coupon_invalid -> explain and let them fix the cart.
429 -> wait Retry-After seconds. Retry network errors and 500s up to 3 times with the SAME Idempotency-Key.
BUILD
1. Menu page: load GET /menu once, group by category, show veg/non-veg marks, add-to-cart with quantity.
2. Cart: keep it in localStorage. Whenever it changes (or a coupon is entered), call POST /orders/quote and show
subtotal, discount, each charge, round-off and total from the response. Never calculate prices yourself.
3. Checkout: pickup or delivery, name, phone, optional email, address for delivery, optional notes.
Validate phone (10-digit Indian mobile or +91 format). Disable the button while sending.
Send POST /orders with expectedTotal = the total shown and an Idempotency-Key.
4. Confirmation page: show orderNumber and total. Save {id, accessToken, orderNumber} in localStorage.
5. "My orders" / order status page: GET /orders/{id} with X-Order-Token; refresh every 30 seconds while open;
show statusText; offer "Cancel order" only while status is pending.
6. Table booking: date (today to 60 days ahead), from/to time, party size, name, phone. Check availability first,
then POST /reservations. Show the table number. Save {id, accessToken}; allow cancelling before the start time.
7. Accessibility and mobile: labelled form fields, large tap targets, works on a phone.
RULES
- Never put any key starting with sk_ in browser code.
- Do not invent endpoints or fields that are not listed above.
- Keep all API calls in one small module (e.g. alws-api.js) with a single fetch helper that adds the headers,
parses errors and retries as described.
  • The publishable key lists every address your site uses (with and without www).
  • No sk_live_ key appears in any browser code, app, or code repository.
  • Totals shown to customers come from POST /orders/quote, and orders send expectedTotal.
  • Orders and bookings send an Idempotency-Key, reused on retries.
  • Online payments: your server verifies the payment with the gateway before calling POST /orders/{id}/payment.
  • A real test order shows up in ALWS RESTRO under Website Orders, and a test booking under Reservations. Cancel both afterwards.