Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
A customer order form that saves orders to a database and sends you an SMS notification on every new order.
- Customers visit the order form URL and fill in their name, phone, product, quantity, and address.
- The order is saved to the val's SQLite database.
- You get a text message (SMS) on your phone with the order details.
| Route | Description |
|---|---|
/ | Customer order form |
/order | POST endpoint that processes orders (called by the form) |
/orders | View all saved orders as JSON (admin) |
You need a Twilio account to send SMS. Create one (free trial works) and get these three values, then add them as environment variables:
- TWILIO_ACCOUNT_SID — Your Twilio Account SID (found on the Twilio console dashboard)
- TWILIO_AUTH_TOKEN — Your Twilio Auth Token (found on the Twilio console dashboard)
- TWILIO_PHONE_NUMBER — Your Twilio phone number (the number Twilio assigned you, in E.164 format like
+12345678900)
👉 Add TWILIO_ACCOUNT_SID here: https://www.val.town/x/omkar1/PaperWork/environment-variables?key=TWILIO_ACCOUNT_SID
👉 Add TWILIO_AUTH_TOKEN here: https://www.val.town/x/omkar1/PaperWork/environment-variables?key=TWILIO_AUTH_TOKEN
👉 Add TWILIO_PHONE_NUMBER here: https://www.val.town/x/omkar1/PaperWork/environment-variables?key=TWILIO_PHONE_NUMBER
SMS notifications are sent to +1 (636) 340-2782. To change this, update OWNER_PHONE in main.ts.
| File | Purpose |
|---|---|
main.ts | Hono HTTP handler — serves form, saves orders, sends SMS |
order-form.html | Customer-facing order form (styled with Tailwind via Twind) |
sendSMS.ts | Twilio REST API helper for sending text messages |