A simple appointment reminder app using Bandwidth's Messaging API, Node.JS, and Express
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Simple Appointment Reminder App Using Node.JS and Express

A simple appointment reminder app using Bandwidth's Messaging API, Node.JS, and Express.

Table of Contents


How It Works

This app checks your database once a day for clients that need to be reminded of appointments and prompts them for a confirmation of their appointment.


Make sure you have at least one Bandwidth number registered to you app.bandwidth.com account and that it is set up to receive callbacks from messaging events. For more info on this, go here.

Set Up Your Requirements in server.js

const express = require("express");
const bodyParser = require("body-parser");
const path = require("path");
const bandwidth = require("node-bandwidth");

Set Up Express in server.js

const app = express();

app.use(bodyParser.urlencoded({ extended: false }));


app.use(express.static(path.join(__dirname, "/public")));

Initialize Bandwidth Client in server.js

const client = new bandwidth({
    userId    : "{{BANDWIDTH_USER_ID}}",
    apiToken  : "{{BANDWIDTH_API_TOKEN}}",
    apiSecret : "{{BANDWIDTH_API_SECRET}}"

Create Appointment Reminder Function and Set on a Daily Interval in server.js

function sendReminderSMS(){

    //first, pull info about the client
    //(their phone number and the date and time of their appointment)
    //from whatever database you are using
    //and set variables
    //If there are multiple clients, you will
    //have to loop through this code
    let apptDate = "{{DATE}}";
    let apptTime = "{{TIME}}";
    let clientNum = "{{CLIENT_NUMBER}}";
    let BWNum = "{{YOUR_BANDWIDTH_NUM}}";

    //create outgoing SMS
        from: BWNum,
        to: clientNum,
        text: "This is a reminder that you have an appointment at {{OFFICE NAME}} on " + apptDate + " at " + apptTime + ". Text YES to confirm your appointment."
    }).then(message => {

//set SMS reminder function
//to run once a day
setInterval(sendReminderSMS, 86400000);

Create Route for Receiving Messaging Callback in routes.js

module.exports = app => {

    //listen for callbacks
    app.post("/callback", (req, res) => {

        //check that callback is from incoming SMS event
        if (req.body.eventType == "sms"){

            //check content of message for 'yes' response
            if (req.body.text.toLowerCase() == ("yes" || "y")){
                //here put however you want to process a confirmation of appointment
        } else {


Require routes.js in server.js


Define Port and Listen in server.js

const port = process.env.PORT || 3000;

app.listen(port, function() {
    console.log("App listening on PORT " + port);


You can now deploy your appointment reminder app to Heroku. Click the button below for more information.