Skip to content

✅ node.js app to send your personal WordPress.com notifications to a Slack room.

Notifications You must be signed in to change notification settings

scottsweb/notifyslack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WP and Slack Logo

NotifySlack

About

This small node.js app will send your personal WordPress.com notifications to a Slack room.

To get setup you will need:

Setup the App

Download or checkout this repository to your local machine. Browse to the downloaded directory in your terminal app and run: npm install (you will need to have node and npm on your system).

Register a WordPress.com App

Visit the WordPress.com Developer site and register a new app. Set the redirect URI to http://localhost:3000 and leave the JavaScript origins section blank. The rest of the information can be personalised to your own requirements.

Once setup make a note of the Client ID and Client Secret and add those to the settings array at the top of notifyslack.js.

You can now obtain your oAuth token. Launch the app:

node notifyslack.js

and browse to:

localhost:3000

Follow the instructions on screen and keep an eye on your terminal. Once you have approved the app you will see your oAuth token in your terminal:

{ create: [Function: create],
	token:
	{ access_token: 'YOUR SECRET',
	token_type: 'bearer',
	blog_id: '0000000000',
	blog_url: 'http://site.wordpress.com',
	scope: '',
	expires_at: Wed Dec 17 2014 09:54:36 GMT+0000 (GMT) },
	expired: [Function: expired],
	refresh: [Function: refresh],
	revoke: [Function: revoke]
}

Copy your access token and add it to the settings array at the top of notifyslack.js.

Create a custom Slack hook

Visit the Slack website and create your custom webhook. Then add the URL to the settings array at the top of notifyslack.js. You can also add your slack_channel (the room you wish to post to) and slack_domain (your company wide domain for your Slack account e.g: wordpress).

Set it Running

Quit the node app with CTRL-C and then set it running again: node notifyslack.js.

You should now see the following in your terminal.

NotifySlack (http://0.0.0.0:3000)
Running NotifySlack...
No new notifications.

The app will check for new notifications every minute and post them to your Slack room.

Heroku

The Heroku branch is for if you want to deploy the app online. You will need to move your app settings into config variables and then deploy the app using:

git push heroku heroku:master

Heroku have a great getting started guide to help you get setup.

Bugs

At the moment the app does not correctly set the messages as seen. This is being worked on.

About

✅ node.js app to send your personal WordPress.com notifications to a Slack room.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published