Skip to content

Mobile app ​

Your store as an app on iOS and Android: the kitloom app signs in, prices its cart, places orders and gets push about them from this site.

kitloom/mobile-apps · admins: kitloom/mobile-apps-filament, kitloom/mobile-apps-nova

Video lessons ​

Recorded in the Filament admin; the Nova admin works the same way.

Your store or your salon as an app on iPhone and Android. The kitloom app is one app for every kitloom site: it reads your pages from the same addresses as your site (every page answers as JSON), and it asks this module for what a phone needs beyond that — to sign in, to price the cart it keeps and place an order, to book a time and change it, to show the account, and to be told by push when an order or a booking moves. One admin, one database, three screens: the site, the iPhone, the Android phone.

The app shows what the site has. With kitloom/shop it is a store: the cart, the checkout, the orders. With kitloom/bookings it is a salon: the services, the free times, a booking, the staff member's day. With both it is both; the module requires neither, and a module switched off on the Modules screen counts as not there.

The app itself is built from your site's name, icon and colours and published under your own Apple and Google accounts (see Getting the app built). This module is the site's side of it. The admin pages are kitloom/mobile-apps-filament or kitloom/mobile-apps-nova: Mobile app → Settings and Devices.

What the owner does ​

Mobile app: the phones it runs on
Mobile app: your store on the phone
  1. Settings → Serve the app. Until it is on, the app's routes answer "not found" and nothing is sent to any phone.
  2. Install links. Where the app is installed from: the App Store and Google Play links once it is listed, or a public TestFlight link and an APK while it is being tried. The app shows them to nobody; your site's theme and the module's banner do.
  3. App Store banner. With the App Store id (the number in the App Store link), Safari on an iPhone offers the app at the top of every page of the site. One meta tag, no script, no cookie.
  4. Push. On, the customer's phone is told when their order is placed, whenever its status changes, and when you write them a note on it, in the site's language. With bookings, the client's phone is told when you confirm, decline, cancel or move their booking, before a visit, to say how it went, and when it is time to book again; the staff member's phone of a new booking and of one a client cancelled or moved (Push bookings to the client, Push bookings to the staff). Always beside the email and the text, never instead, and never to whoever did it. Push goes through Expo's push service, which holds the app's Apple and Google credentials; an access token from Expo's dashboard is optional and kept encrypted.
  5. Oldest app version served. An older app is told to update before it goes on. Leave it empty to serve every version.
  6. Downloadable products. Off by default: a downloadable product is bought on the site only, because Apple makes an app sell digital goods through its own purchases. Physical goods and services are paid as on the site.

Devices lists the phones the app runs on — the platform, the app's version, whose it is, when it was last seen. Delete one and it gets no more push.

Offers and news ​

Mobile app: an offer to the phones that said yes

A message to many phones at once — a sale, a new product, the shop closed on Monday. It reaches only the phones whose person said yes to offers and news in the app: the app asks, the answer is kept with its time, and one tap in the app takes it back. Order notices are apart and need no such yes. Apple and Google require exactly this of an app that pushes offers.

What a message has: a title (a phone shows about 40 characters), a text (about 150), and if you want a link — a product, a category, a post or a page of this site, opened in the app on a tap — and a coupon, put into the cart. Whom it is for: everyone who said yes, only those signed in or only guests, those who bought a product or from a category (a paid order, the category with its subcategories) on a shop, a salon's clients by their visits (seen in the last so many days; not seen for so many weeks with nothing booked ahead — the ones to win back; a staff member's; those who had a service — a visit being a booking marked done), the phones of one language. The count of phones is shown before anything goes.

It goes now or at a time you set. Two things hold it back, both in Settings:

  • Quiet hours (21:00 to 09:00 by default, the site's time): a message due then goes in the morning.
  • Offers a phone gets in a week (2 by default): a phone that had its share gets the next message in its inbox only, without a push.

How it did is four numbers, and each says less than it seems:

NumberWhat it is
AimedThe phones of the audience when it went
PushedExpo took the push for the phone
DeliveredApple or Google took it for the phone — not that anyone saw it: neither says whether a notification was shown or swiped away
OpenedThe person opened it — tapped the push, or opened it in the app's inbox. The app says so; counted once per person

A push is gone once swiped, so the app keeps an inbox: every message sent to the phone, read or not, for 90 days. Signed in, a person sees there what their other phones got too.

Whoever sends needs the permission Send messages to the app (send_app_messages), which administrators and editors hold; it is apart from managing the app's settings. An AI agent can write a draft and read how earlier messages did (mobile_app_messages_draft, mobile_app_messages_list); it cannot send — a person does.

What the app does on the site ​

  • Signs in with the email or login name and the password, as the site's login form takes them, with the same locks against guessing. A sign-in makes an application password named after the phone ("Ada's iPhone · Green Pantry"), which the phone keeps as its token: it is listed with the user's other application passwords (WordPress REST API → Application passwords, and on their profile), and revoking it signs the phone out. An account that signs in with a second factor (kitloom/two-factor) is asked to use the site: the app has no step for the code.
  • Signs up while Account sign-up is on in the shop's settings — on a site without a shop, while Anyone can register is on in Settings → General — and asks for a lost password through the site's own email.
  • Prices its cart. The cart lives on the phone. The site prices it — the lines with their cards, the coupons, the shipping rates for the address, the taxes, the total — and says on each line what cannot be bought (sold out, gone, a download). A signed-in customer's lines are also the ones the site keeps for them, so the phone and the browser share one cart.
  • Places the order as the site's checkout does, with the same fields and checks, as the customer or as a guest while the shop allows it. Cash on delivery and a bank transfer end in the app; an online gateway's page opens in the phone's browser, and the app reads the order back to learn it is paid.
  • Books a time. The services, who does them and the free times are the ones the site's booking form shows. A booking is made as the signed-in client or as a guest with a name, an email and a phone; a taken time is told as the form tells it. A booking with a deposit answers the page it is paid on, which the app opens in the phone's browser. The client cancels and changes the time while your rules allow it, and keeps their own note for you.
  • Shows a staff member their day. A user linked to a staff member sees the bookings waiting for them and the day's, confirms, declines, marks done or no-show, and adds a note about a client — what the account page's Schedule shows.
  • Shows the account: the sections every module offers the account page — orders, addresses, downloads, appointments, the schedule. The app names no module; a section installed later is there at once.
  • Asks for the account to be erased. The App Store requires that an app which makes accounts lets the user delete theirs from the app. With kitloom/privacy installed, the app files an erasure request for the user's own email, as the owner files one: the person confirms it from the email, and the owner erases what the law lets go under Tools → Erase Personal Data. Without kitloom/privacy the app shows the site's email instead.

With kitloom/privacy, Tools → Export Personal Data lists the user's devices (never the push token) with their answer about offers, and the messages their phones got; Erase Personal Data forgets the phones and their inboxes.

Getting the app built ​

The app's code is kitloom/app, an Expo (React Native) project. One file, kitloom.json, names the site: npm run configure -- https://your-site.example reads this module's app/v1/site and writes the name, the icon and the colours into it. Then eas build makes the iPhone and Android builds under your own Apple Developer and Google Play accounts, and TestFlight and Google Play's testing tracks hand them to your first testers before the stores list them. Apple lists a store that ships; a demo store is refused.

Routes ​

Under the site's REST root, /wp-json/app/v1/, with WordPress's JSON errors. A phone sends its token as Authorization: Bearer <token>; no session, no CSRF. Every route answers mobile_app_disabled (404) while the app is not served, and mobile_app_update_required (426) to an app older than the minimum (the X-Kitloom-App header names its version).

RouteMethodsWhat
/siteGETThe site's name, icon and logo, language, the account's sections and account.signUp, the install links, the minimum version, whether push is on, app.features (which of the routes below this site answers: reviews, favorites, messages, bookings, forms); with a shop currency, shop (its pages and rules, the payment methods) and reviews, with bookings bookings (the clock, the days a time may be on, what a client may change, the ways a deposit is paid; location and phone — the salon's, the first open location's once there are locations; and, once the salon has made a location, locations — the open ones as the site's booking part lists them: id, slug, name, address lines, phone, hours, page, image, and the ids of the staff who work there and the services done there) — null without
/auth/sign-inPOSTlogin, password, app (the app's name), device (name, platform, app_version, locale, push_token) → token, user
/auth/sign-upPOSTname, email, password, app, device → token, user (404 while sign-up is off)
/auth/meGETThe token's user, with their addresses on a shop (billing, shipping, checkoutDefaults; null without one)
/auth/sign-outPOSTRevokes the token; push_token frees the phone
/auth/forgot-passwordPOSTlogin — the site's reset email, the same answer whether an account matched or not
/auth/accountDELETEpassword — an erasure request through kitloom/privacy (202), 501 without it
/cart/quotePOSTlines (product_id, quantity, variation_id, variation), coupons, destination, shipping_rate, email → the cart as the site's cart page sees it, plus problems per line
/cart/savedGET, PUTThe signed-in customer's lines kept on the site
/checkoutPOSTlines, coupons and the checkout's fields (billing_*, shipping_*, ship_to_different_address, shipping_method, payment_method, order_comments, createaccount, account_password, terms) → order, payment.url for a gateway, token for an account made here
/orders/{id}GETThe order, the customer's own or a guest's with ?key=
/account/{section}GETA section of the account by key, with its own query (id, list)
/account/detailsPOSTThe name, the email, a new password with the current one, as the account page saves them
/account/addressPOSTAn address (type: billing or shipping), as the shop's forms save it
/products/{id}/reviewsPOSTrating, review — a review by the signed-in customer, under the shop's rules (reviews open, verified owners only, moderation); review.approved says whether it is shown at once
/favoritesGET, PUTThe signed-in customer's hearts, kept with the account (items: id, slug, title, image, priceFormatted, up to 200) so another phone finds them
/auth/social, /auth/social/tokenPOSTWith kitloom/social-accounts: provider and return (the app's own address, myapp://auth) → url to open in the system browser and a verifier to keep; the browser comes back to return with ?code=, and code with verifier → token, user; a sign-in the site refused comes back as ?error=refused&reason= with kitloom/social-accounts' word for it (email_taken, no_account, no_email, linked_elsewhere, denied, failed). /site lists the services under account.social
/bookings/locationsGETThe salon's open locations in the owner's order, as bookings/v1 answers the booking form ([] without any)
/bookings/services, /bookings/staff, /bookings/slotsGETWhat bookings/v1 answers the booking form: the services, the staff (?service=), a day's free times (?service=&date=, &staff=) or how many each day has (?service=&from=&days=); &location= (a slug or an id) what is done there, who works there, the times there
/bookingsPOSTservice, staff, start, client_note, location (required where two or more locations take bookings: else 422 booking_location), and for a guest name, email, phone → booking, message, manageUrl, and calendarUrl or, with a deposit, payUrl. A guest who sends account: true (and app) is signed in with the booking where sign-up is open: an account is made for the email, token and user come back, and the link to choose a password goes to the email; an email that has an account books as a guest and gets signIn: true
/bookings/clients, /bookings/for-clientGET, POSTFor a staff member or a manager: the client cards they see (?search=), and a booking made for a client — client (a card) or name with phone or email, service, start, client_note, location (none: where the staff member works then); a staff member books into their own day
/bookings/{code}GETOne booking, for its client (role: client) or whoever decides on it (role: staff), with urls.calendar and urls.pay
/bookings/staff/me/week, /done, /time-off, /clientsGET, POST, DELETEA staff member's working side: seven days of their bookings and time off (?from=); the visits behind them with totals (`?period=day
/bookings/desk/{code}/times, /moveGET, POSTThe salon moves a booking — its staff member's own, or any for a manager: the free times of a day (?date=) or how many each day has (?from=&days=), with the staff who may take it (a manager's choice, ?staff=); move takes start and from a manager staff. The client is told. POST /bookings/desk/{code}/reassign asks the salon to give the visit to a colleague and DELETE takes that back; the client is told nothing by either, and salon/day lists such visits under reassign with who is free at that time
/bookings/desk, /bookings/salon/day, /done, /month, /time-off, /clientsGET, POST, DELETEdesk — who the caller is at the salon (staff, manages). For whoever manages the bookings, the working side of the whole salon: a day of every staff member (?date=, &location= one location's), the totals with byStaff, time off for a staff member (staff) or the salon closed (none), every client
/bookings/bills/{code}, /lines, /tip, /pay, /refund, /bookings/till, /bookings/salon/tillPOST, DELETE, GETWith kitloom/booking-checkouts: a visit paid at the salon, by whoever decides on its booking — the bill made on first asking, lines added and taken off, the tip, a payment by hand (method cash or other, amount for a part), money given back by a manager; the day's takings, a staff member's own or the salon's. A card through the salon's own Stripe: /bookings/terminal/token for Tap to Pay on the phone, /bills/{code}/card and /card/settle; /bookings/terminal/readers and /bills/{code}/reader (/reader/cancel) for a reader on the counter. /site says bookings.checkout
/bookings/{code}/messagesGET, POSTThe talk about a visit between its client and the salon (the staff member it is with, a manager): the thread as the caller reads it — open, side, messages (mine, name, body, date, read) — read by asking; body adds a line, pushed to the other side's phone. /site says bookings.messages while the salon takes them
/bookings/{code}/times, /bookings/{code}/moveGET, POSTThe times the client may move it to, and the move (start)
/bookings/{code}/{action}POSTcancel by the client; confirm, decline, done, no_show, cancel by its staff member or a manager (reason)
/bookings/reviewsGETWhat clients said of their visits: average, count, stars, a page of reviews (?page=, ?staff=)
/bookings/{code}/reviewPOSTrating (1 to 5), body — the client's review of their own visit that happened, once
/bookings/me/note, /bookings/clients/{id}/notesPOSTThe client's own note and reminders (own_note, reminders); a staff member's note about a client (body)
/forms/{id}POSTWith kitloom/forms: a contact form of the site, drawn by the app from the page's shortcodes part — its fields, the honeypot's two fields as the page gave them and _page (the page it was on) → the form's own answer (status: mail_sent, validation_failed, spam, mail_failed; message; invalid_fields). It is the message the site's form makes — in Contact → Messages, the form's emails, the owner's notice — marked Mobile app where the browser is named. The site's captcha is not asked, as a phone cannot draw it: the honeypot and Akismet are, and one address sends three a minute, ten an hour
/devicesPUTpush_token, platform, name, app_version, locale — a guest's phone too; offers (true or false) is the person's answer about offers and news, left as it was when not sent
/devices/{token}DELETEForgets the phone, with its inbox
/messagesGETThe phone's inbox by push_token, and the signed-in person's other phones': messages (id, title, body, url, coupon, received_at, read), unread, page, more
/messages/{id}/openedPOSTThe person opened the message (push_token)

The shop's routes — the cart, the checkout, the orders, an address, the reviews, the favorites — answer rest_no_route (404) on a site without kitloom/shop, and the bookings' on one without kitloom/bookings. The bookings' are kitloom/bookings' own controllers, mounted here so the phone's token signs what the site's session signs under bookings/v1; the booking itself skips the form's spam protection, which a phone cannot draw, behind a throttle of its own.

The catalogue is not here: a product, a category, a search and the front page are read from their own addresses with Accept: application/json (?include=catalog, productDetails, storefront, menus), as the site's own front end reads them.

Settings ​

OptionDefaultWhat
mobile_app_enabledoffThe app is served
mobile_app_ios_url, mobile_app_android_url, mobile_app_testflight_url, mobile_app_apk_url—Install links
mobile_app_ios_app_id—The App Store id, for the banner
mobile_app_smart_banneroffSafari's App Store banner on the site's pages
mobile_app_min_version—The oldest app version served
mobile_app_push_enabledonPush about orders
mobile_app_expo_token—Expo's access token, encrypted; written by the settings page only
mobile_app_downloadsoffDownloadable products may be bought in the app
mobile_app_push_order_notesonA note to the customer on their order rings their phone too
mobile_app_push_bookingsonThe client's phone hears of their bookings
mobile_app_push_bookings_staffonThe staff member's phone hears of new, cancelled and moved bookings
mobile_app_offers_per_week2Offers a phone is pushed in seven days; 0 — no limit
mobile_app_quiet_from, mobile_app_quiet_to21:00, 09:00The hours no offer goes out in, the site's time; empty — none

Push ​

SendPush is a queued job: the customer's phones are told from the queue, through https://exp.host/--/api/v2/push/send, one ticket per phone. php artisan mobile-apps:push-receipts (scheduled hourly) reads the receipts and forgets the phones Apple and Google no longer know, as Expo asks every sender to. The phones are mobile_devices, the tickets mobile_push_tickets.

Push\OrderPushes listens to the shop's OrderPlaced, OrderStatusChanged and OrderNoteAdded and carries {type: 'order', id}. Push\BookingPushes listens to the bookings' BookingRequested, BookingStatusChanged, BookingMoved and ClientReminded: a client's push carries {type: 'booking', code} (in the language the booking was made in), a staff member's {type: 'schedule', code, day}, "time to book again" {type: 'book', service, staff}.

A message is a row of mobile_messages, written by Messages\MessageWriter with the acting user: create() and update() (a draft; stage() for an admin that saves the model itself), schedule($message, $at) — now when no time is given — cancel(), reach($audience), test($message, $actor) to the author's own phones. Messages\Sender sends it a hundred phones at a time (SendMessageChunk, each job the next): a phone gets its row in mobile_message_deliveries before its push goes, so a chunk tried again pushes only to the phones still waiting. mobile-apps:send-messages (every minute) starts what is due and picks up a message left half sent; mobile-apps:prune (daily) deletes inbox rows older than messages.keep_days and the phones of guests unseen for devices.forget_guests_after_days. The push carries {type: 'message', id, url, coupon}. Tests fake Expo with Testing\FakesExpo.

Configuration ​

php artisan vendor:publish --tag=kitloom-mobile-apps-config for kitloom-mobile-apps.php: routes.register, push.endpoint and push.timeout, messages.connection, messages.queue and messages.keep_days, devices.forget_guests_after_days, ai.register, privacy.register, and the admin sections (filament.register, nova.register). The rate limit and the application passwords are kitloom/api's.

Tests ​

From the application that installs the package: php vendor/bin/phpunit --testsuite MobileApps.

Read more ​

kitloom — sites on Laravel, built for you and run with AI.
Contact · Services · License · Refunds · Privacy · Community · YouTube · [email protected]