Build SMS Appointment Reminders with RedwoodJS and MessageBird - code-examples -

Frequently Asked Questions

Create a new RedwoodJS project, install required dependencies like MessageBird and Prisma, define the database schema for appointments, and implement the API logic to handle bookings and scheduling. Then, build a frontend form for users to book appointments and connect it to the backend API. Finally, configure the SMS integration with MessageBird to send automated reminders.
RedwoodJS is the core framework for building the web application. It provides a full-stack, serverless-first environment based on React, GraphQL, and Prisma, enabling rapid development of both frontend and backend components.
MessageBird is a communications platform offering a reliable SMS API and phone number lookup capabilities. This integration allows for automated SMS reminders to be sent to users, minimizing no-shows and improving appointment management.
While this tutorial uses Moment.js for date/time manipulation, it's in maintenance mode. For new projects or significant updates, consider modern alternatives like date-fns, Luxon, or native JavaScript Date/Intl methods for better performance and maintainability. This is especially crucial for production-level applications
Yes, RedwoodJS supports authentication features. You can use Redwood's built-in authentication generators to easily add user accounts, enabling users to manage their own appointments and access personalized features. After generating authentication you can add the `@requireAuth` directive to the relevant services.
The guide provides examples for PostgreSQL and SQLite. PostgreSQL is generally recommended for production environments, while SQLite is suitable for simpler development and testing purposes. The Prisma ORM handles database interactions.
The application uses the MessageBird Lookup API to validate phone numbers. This API verifies the number's format and identifies the number type (e.g., mobile, landline), ensuring only valid mobile numbers are used for SMS reminders.
The application enforces a minimum booking time of 3 hours and 5 minutes in the future. This time constraint is implemented in the backend service logic, ensuring adequate time for reminder scheduling.
The tutorial implementation uses date-time parsing that depends on the server's time zone, which can be problematic. Ideally, you should implement robust timezone handling using specialized libraries like `date-fns-tz` or Luxon, storing all dates and times in UTC format.
While not covered in the initial setup, implementing MessageBird webhooks allows receiving real-time status updates for SMS messages. This provides feedback on delivery success or failure and enables more advanced features like retry mechanisms or notifications.
Appointment data is stored in a relational database (PostgreSQL or SQLite). The application uses Prisma, a next-generation ORM, to define the database schema, manage migrations, and interact with the database seamlessly from the API side.
RedwoodJS utilizes GraphQL for communication between the frontend and the backend API. The frontend uses GraphQL queries and mutations to request and modify data, while the backend defines the GraphQL schema and resolvers that handle these requests.
The optional `messageBirdId` field stores the unique identifier assigned to the scheduled SMS message by MessageBird. This allows for tracking the message status and potentially canceling or rescheduling it later.
RedwoodJS offers deployment options for various platforms like Vercel, Netlify, and Render. Consult the RedwoodJS deployment documentation for specific instructions. Make sure to properly configure your environment variables (DATABASE_URL, MESSAGEBIRD_API_KEY, etc.) in your production environment.