Scheduled motivational quotes via Slack.
About | Installation | Extension
I have created this repository for as a personal project to have a Slack app send me (and some friends) motivational quotes each weekday morning. Feel free to use whatever code is available here for your own personal use. Do cite properly, though!
Here's the stack I went with:
- Node.js worker process (via
node-schedule
) - Slack API
- Mongoose
- MongoDB instance hosted on Heroku
- Travis CI for unit testing/validation
-
Clone it.
$ git clone https://github.com/kalyons11/motivator.git $ cd motivator/
-
Install it.
$ npm install
-
Set up your environment variables.
$ cp .sample-env .env
Now, in the
.env
file, you should set the following keys accordingly:TEST_KEY
: do not touch, used for testingMOTIVATOR_DEBUG
:true
orfalse
according to your debug preferenceDEV_DB_URL
: url to local MongoDB instancePROD_DB_URL
: url to remote MongoDB instanceSLACK_URL
: url to Slack app webhook
-
[Optional] Run some tests to make sure everything is okay.
$ npm test
-
Once you have your
.env
set up, you can run the process locally to make sure everything works.$ npm start > motivator@1.0.0 start /path/to/repo/motivator > node src/index.js 2018-01-04T04:51:09.524Z - info: Scheduled job.
You can also add your own quotes to the database as you come across them.
Note: Make sure you have your MOTIVATOR_DEBUG
variable set correctly here
so you write to the desired database.
$ npm run-script add
> motivator@1.0.0 start /path/to/repo/motivator
> node src/add.js
prompt: text:
You can enter the text and author for a given quote, then type y
continue and add another, for as long as you want!
Once you are done adding quotes, simply type n
at the continue prompt.