Schedule Notification(Reminder) using Agenda.

Hey Guys,

I will be walking you through how to schedule a reminder using Agenda, If your platform has a service a user can join, and the service is to start on a future date, It will be nice to remind the user again before its starts, so they don't miss out, right? For this article, we will assume you have the Email and SMS services of your choice set up.

Agenda is a lightweight job scheduling library for Node.js, which has Mongo backed persistence layer.

Installation

npm install agenda

yarn add agenda

we also are to install MongoDB.

npm install MongoDB

Configuration

For this article, I will assume you are familiar with MongoDB. Let have Agenda connected to MongoDB, In the root directory of our project, create a folder named libs, and a file named agenda.js and add the codes below, this returns an Agenda instance, that will be used to define, schedule jobs, etc.

carbon (1).png

In the root directory of the project, create a file named app.js, copy and add the codes below

carbon (2).png

The code block sends runs the SendEmailToUser function, agenda then queues the defined job and runs the job (SendSMSToSingleUser) after the stipulated time.

This is the basic setup for Agenda, to read more and know more about Agenda: Check here.

I might be updating this article to a full-blown one, where we integrate AWS SES and Twilio for sending emails and SMS.

Best Regards Amigo.