Guides & Tutorials

How to Build SMS Meeting Reminders with Node

Learn how to build SMS meeting reminders for your customers by using the Telnyx SMS API and Node.

Tony Furnas
SMS meeting reminders with Telnyx and Node graphic
The Telnyx SMS API makes it easy to integrate SMS communications into your apps. The developer-friendly API allows you to build the types of messaging capabilities you want with ease. By using our Meeting Reminder tutorial, you’ll be able to remind customers of their upcoming meetings via SMS.
In this guide we’ll go over how to create the meeting scheduler using the Telnyx API. We’ll be using Node for the examples in this article, but you can access guides for other languages.

Configuring you SMS Capabilities

Create a config.json file in your project directory. First, use our guide to provision an SMS number and messaging profile, and create an API key. Then add those to the config file, along with your country code.
3    "COUNTRY_CODE": "+1",
Note: This file contains a secret key, it should not be committed to source control.
Server Initialization
First, import the config file and initialize the Telnyx library.
1const config = require('./config.json');
2const telnyx = Telnyx(config.API_KEY);
Then create an express app that watches the templates directory with Nunjucks, a simple templating language, and parses form data.
1const app = express();
3app.set('views', `${__dirname}/templates`);
5expressNunjucks(app, {
6    watch: true,
7    noCache: true,
Collect User Input
Create a simple HTML form, index.html, which collects the meeting date, time, customer name, and phone number. The full HTML source can be found in our GitHub repo, and we'll serve it at the root.
1app.get('/', (req, res) => {
2    res.render('index');
Implement the SMS Notification
Create a function that sends an SMS message parameterized on the destination number and text.
1function sendReminder(to, message) {
2    telnyx.messages.create({
3        to: `${config.COUNTRY_CODE}${to}`,
4        from: config.FROM_NUMBER,
5        text: message 
6    });
Parse User Input and Schedule the Message
Within the POST handler, parse the meeting time and compute how far into the future it is. We're using the moment Javascript library for this. Note that moment will use the current timezone for both datetime instances.'/', (req, res) => {
2    const meetingDatetime = moment(
3        `${req.body.meeting_date} ${req.body.meeting_time}`,
4        'YYYY-MM-DD hh:mm');
5    const now = moment();
7    const delta = moment.duration(meetingDatetime.diff(now));
8    // ...
If the meeting is sooner than 3 hours, 5 minutes from now, return an error.
1if (delta < moment.duration({hours: 3, minutes: 5})) {
2    res.render('index', {message: 'Can only schedule meetings at least 3 hours, 5 minutes in the future'});
3} else {
4    // ...
Remind the User
If the time is valid, compute when to send the reminder and schedule the function call. Note that we're using setTimeout here, but a production solution should make use of an asynchronus processing toolkit.
1const reminderDatetime = meetingDatetime.subtract(3, 'hours');
2const message = `${req.body.customer_name}, you have a meeting scheduled for ${meetingDatetime}`;
4setTimeout(() => {
5    sendReminder(, message);
6}, reminderDatetime.diff(now));
Finally, render the success template, success.html.
1res.render('success', {
2    name: req.body.customer_name,
3    meetingName: req.body.meeting_name,
4    meetingDT: meetingDatetime,
5    phone:
Start the Server
Start the Express app.
1const port = 3000;
2app.listen(port, () => console.log(`App running on port ${port}`));
Running the Project
Simply run node scheduler.js at the command line.
Share on Social

Get Started for Free!

Create a free account to set up voice, messaging, IoT, video & more.