Giter Site home page Giter Site logo

happy_messages_bot's Introduction

Happy Messages Bot

Screen Shot 2021-07-24 at 9 08 56 PM

Description

This bot was created to send happy email messages to my Mom at set times throughout the day and year.
At 9, noon and 6pm, different greetings will be sent to my mom.
I have also created a message to remind my mom to drink water. That goes out every day at 1pm.
Inside the messages.js and holiday-messsages.js file, I have created all of the variables for the messages.
The bot also sends out messages once a year on Christmas, Valentines Day and New Year's Day.

How to fork a repo

https://docs.github.com/en/get-started/quickstart/fork-a-repo

How run the bot locally

  1. In your terminal, run git clone https://github.com/YOUR-GITHUB-USERNAME/Happy_Messages_Bot.git.
  2. In your terminal, under the project directory, run npm install to add the node_modules folder
  3. In your terminal, under the project directory, run touch .env. Store these variables inside the file with our own email address, password and mom's email.
ADMIN_EMAIL = YOUR EMAIL ADDRESS 
ADMIN_PASSWORD = YOUR PASSWORD
MOM_EMAIL = YOUR MOM'S EMAIL
  1. In your terminal, run npm start

If you want to test sending your own message, then run this code.

//this runs every minute after the server starts
nodeCron.schedule('* * * * *', () => {
  async function testingMsg() {
    let info = await transporter.sendMail({
    from: ADMIN_EMAIL, // sender address
    to: MOM_EMAIL, // list of receivers
    subject: "Just testing", // Subject line
    text: "Hello world?", // plain text body
    html: "<b>Hello world?</b>", // html text
    })
    console.log(`Message send: ${info.messageId}`)
  }
  testingMsg().catch(console.error);
});

Technologies used

Node.js
Express.js

Packages used

NodeMailer
Node-cron
Nodemon

Node Cron syntax

 # ┌────────────── second (optional)
 # │ ┌──────────── minute
 # │ │ ┌────────── hour
 # │ │ │ ┌──────── day of month
 # │ │ │ │ ┌────── month
 # │ │ │ │ │ ┌──── day of week
 # │ │ │ │ │ │
 # │ │ │ │ │ │
 # * * * * * *

happy_messages_bot's People

Contributors

jdwilkin4 avatar

Stargazers

Roman avatar

Watchers

 avatar

Forkers

techdog24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.