'memba?: Twilio & Vertex AI SMS Reminder System for Seniors who don't 'memba.
✨ As part of dev.to Twilio AI challange me and @isitayush crafted a digital guardian angel for seniors (not you... probably).
Table of contents
Here's how 'memba works:
You simply send an SMS message to a designated Twilio phone number +44 7822 021078. The message should be formatted like this:
Remind me to take medicine on 24nd June 18:00
.Twilio sends SMS to our Node.js/Express.js app container.
⚡ This app is containerized using Docker Hub and run using Google Cloud Run (hail automation).
- The Cloud Run application forwards the SMS content to Vertex AI (Gemini LLM), with our predefined instructions.
Functionality:Parse reminder text into JSON format.
Input:The text of the reminder and/or date, time.Output:JSON string in the format: {'reminder_text': "<text>", 'reminder_datetime': "<ISO 8601 extended format>"}.
Don't include any introduction text likt "Hello...", "Remind me to...", "Please..." in reminder_text.
Error handling:If the reminder text doesn't follow the expected format (e.g., missing date/time), return an empty JSON string {}.
If the date/time is not set or can't be parsed, return an empty JSON string {}.
If reminder_text is empty or not set, return an empty JSON string {}.
If date is set, but time is not set, use current time. If time is set, but date is not set, use current date.
Don't return the JSON string as markdown.
Do not delimit the output JSON with anything.
If reminder text contains abstract date, time meanings like "tomorrow", "next week", "next month", etc. then convert them to date, time as ISO8601 extended format - for example, "tomorrow" becomes <current_date> + 1 day or "next week" becomes <current_date> + 7 days, etc.
- Vertex AI then translates the extracted information into a structured JSON format like this:
{
"reminder_text": "take medicine",
"reminder_datetime": "2024-06-24T18:00:00.000Z"
}
We then send the JSON out to our Cloud SQL MySQL database and store it (we chose to use Prisma in our Node.js app).
Then a background job (we also put it directly in our Node.js app) runs every minute. This job scans the database for reminders scheduled within the next minute.
For identified reminders, the job triggers an SMS notification back to the senior's phone via the Twilio API precisely at the set
reminder_datetime
.
Demo
- Send your SMS reminder (for example,
Remind me to take medicine on 24nd June 18:00
) to +44 7822 021078.
⚡ We bravely topped up our Twilio account.
You can also fork our solution from here: richardevcom/memba
Check out our landing page (yeah, because why not?): 'memba?
Here is a quick demo video:
🐞 Known issues
- Our LLM is smart enough to parse data, but not smart enough to determine correct timezone from phone nr. country code. Expect your reminders to have date/time offset.
⚡ Many countries have multiple timezones (did you know that France has 12 timezones? 🤯) and one phone number country code - which basically leads our solution to have date/time offsets.