Skip to content

💬 Track Contentful entries changes on Slack, without moving a finger.

Notifications You must be signed in to change notification settings

brh55/slack-contentful

Repository files navigation

Slack Contentful Slack Icon Contentful Icon

GitHub tag Travis branch Dependency Status XO code style

Slack-contentful allows users to recieve push notifications on specified Contentful updates to a designated Slack channel. Updates are based on the following events: create, save, auto save, archive, unarchive, publish, unpublish, and delete.

Example Update

Requirements

Automated Set Up w/ Heroku

Allow for incoming hooks to your team's Slack

Add to Slack

Deploy the server to your own Heroku instance, and set SLACK_WEBHOOK to the incoming hook url from the integration above

Deploy

It's preferred to set your locale, and leave your bot's emojis and username blank as these can be edit through the "Incoming Hooks" page by other team members.

Manual Set Up

Configuration

The configuration of the bot are set with environment variables using an .env file. Please look at the example.env file of possible configurations, and create an updated .env file before you deploy.

Available Configuration Options:

ENV Variable Required Description Default Value
SLACK_WEBHOOK Y The webhook Url provided by the incoming hooks N/A
SLACK_CHANNEL Y The slack channel to send notifications N/A
ENTRIES N A comma seperated list of Contentful Entry IDs you want to be notified of N/A
TRACK_ALL N Set this to true if all Contentful updates should be notified, this will override tracked entries false
LOCALE N (but preferred) Contentful Locale to be tracked, currently only supports up to 1 en-US
PORT N The port for the node server to run on 5000
UPDATE_COLOR N Hex color for updates posted #27ae60
BOT_USERNAME N The bot's username ContentfulUpdates
BOT_EMOJI N The bot's icon pencil2
LARGE_PREVIEW N Should a large image preview be used for an asset notification false

Here's an example, of how your .env would look like. .env

SLACK_WEBHOOK = https://hooks.slack.com/services/TA123ka9/A123910a9d8/mkas929199sad83lmk7h
SLACK_CHANNEL = #ContentfulFeed
ENTRIES = 6OFbybzxM4WOCuIO4qo8Qs,6aFz3qcuPe0eA8kwQm0Ume,6a232jal2eA8kwQm0Ume,etc
LOCALE = en-UK
PORT = 5000
UPDATE_COLOR = #27ae60
BOT_USERNAME = ContentfulUpdates
BOT_EMOJI = bomb
LARGE_PREVIEW = true

Deploying Steps

  1. Set up the address of your server to configure where Contentful outgoing hooks should be sent to. (ex: myapp.heroku.com, botcontentful.mycompany.com)
  2. Clone or download/unzip this repo to your serer
  3. Adjust your .env file as outlined above
  4. Install Node.js on your server if not done so already
  5. Install repo dependencies
$ cd to/repo
$ npm install
  1. Start the server
$ npm start

Contentful Configuration

  1. Go to Contentful.
  2. Login with your credentials.
  3. Locate the cog icon labeled settings, and click on 'webhooks'.
  4. Hit 'New Webhook', and enter your server address in the URL bar.
  5. Click 'Create Webhook'.
  6. The notifications can be customized based on particular events. examine config below

Contentful Event Triggers

NOTE: AUTO_SAVE event will always be triggered after PUBLISH events. To prevent redudant AUTO_SAVE  
      events, uncheck AUTO_SAVE triggers.

Post Deployment - Test & Debugging

After your app has deployed, go to your server url and go to the /debug endpoint to verify your settings, and help with debugging any potential issues.

Example:

http://myherokuapp.heroku.com/debug

If you've successfully deployed, you should get a successful message stating Successful Set-up along with a table of configurations to verify against as depicted below.

successful set up

If set up was unsuccessful, you should get a message to verify your configurations, along with important configurations that the server has set up.

unsuccessful set up

Contribute

If you would like to contribute to this project, take a look at the wiki to get started.

Feel free fork and submit PRs, if applicable reference the issue, or explain the intent of the PR. If it's suitable, I'll go ahead and merge it.

About

💬 Track Contentful entries changes on Slack, without moving a finger.

Resources

Stars

Watchers

Forks

Packages

No packages published