jmontae / buffit

use the /buffit slash command to send Slack messages to your Buffer profiles!

Home Page:http://www.jermaine.fyi/buffit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

buffit logo

This app is built with Node and Express, and comes ready to go for Heroku deployment.

Other modules used are the body-parser middleware for express and request for simplified HTTP requests. You can also check out the Slack API and the Buffer API documentation for more information.

Get you an app for your Buffer

First thing you should is set up an app for your [Buffer account](http://buffer.com/developers), and take note of the credentials:
  • client_id
  • client_secret (you'll receive this by email)
  • access_token

redirect_uri is required to set up the app, however, you won't be in need of that for the slash command.

Deploy the code to Heroku

Next step is deploying the code to Heroku. But **before you do**, check the `PROFILE_IDS` object in the code and add the profiles you would like to post to.
const PROFILE_IDS =
{
  'service': ['username']
};

A little explanation how it works:

  • the app makes a request to the Buffer API for the list of profiles you have.
  • the app will then search for service, then username in the packet that was received. It'll get the corresponding id for use in the API request.
  • the service values are an array, so just add the usernames of any profile for that service. For example, if you have two Twitter profiles you'd like to post to, add 'twitter': [ 'handle1', 'handle2' ] to the object.

Once you've done that and deployed the code, take note of the URL to your app in Settings. (should be an https URL). This is also where your Config Vars are located, so plug those Buffer credentials in there.

Set up a slash command integration for your Slack group

Check out [this page](https://my.slack.com/services/new/slash-commands) on steps to do that.

You'll use the Heroku URL at set up, with the "/command" route at the end. (ex: https:// yourapp.herokuapp.com /command) Also take note of the access token it gives you, and go back to your Config Vars in the Heroku settings and plug it in.

Test it out!

A simple `/buffit` (or actually, whatever slash command you gave at set up) and `hello world` to test and you're good to go! The app will post back to the channel where you initiated the command with a nice "thank you" message. And double check your Buffer queue for the post. :)

Any issues you find, feel free to let me know or make a pull request. Hope you like it!

About

use the /buffit slash command to send Slack messages to your Buffer profiles!

http://www.jermaine.fyi/buffit

License:MIT License


Languages

Language:JavaScript 100.0%