Upper is easier. This plugin helps the connection between Slack and WordPress and you can concentrate on what you should do with slack.

Setup

Everything you need can be set up on admin screen. Go to Setting > HameSlack Setting and save credentials.

How To Use

Most simple is posting to slack. There is a simple way to do it.

<?php do_action( 'hameslack', $content, $attachments, $channel ) ?>

Why do_action? Because in WordPress environment, PHP functions causes Fatal Error when plugin is deactivated. do_action affects nothing even if plugin suddenly disappears. $attachments is an array of associative array and you can specify image, title, color and so on. Please see Slack Documentation for more detail.

Okay, so when should you do it?

Case 1: Request Review

Let’s consider the case that you are managing a news media on WordPress. There are some editors and many writers. On your work flow, novice writers cannot publish posts without review because they are not reliable. This is very usual on popular news sites.When novice writers finished their post, they change post status to ‘pending‘. Now editors go to admin screen and change its status to ‘publish’.

This workflow sometimes stacks up at editor’s review. So it’s nice to send notification to slack. Incoming Webhooks enable this.

Case 2: Make draft from slack

If you use Slack as communication tool and use WordPress as publishing platform, probably you spend more time on Slack. But the conversations on Slack are ‘flow’ and difficult to find in future. If someone post nice idea, save it as draft.

If you have periodical notice, this flow becomes much better(e.g. “7 days have been past since a draft xxx created, what’s up?”).

Case 3: Log Weekly Chat with Specific Keywords

Let’s consider the case you have music review site and make a weekly list of tweets. But you don’t want include negatives tweets, so your team members post twitter URL to Slack by hand with keywords “GT”. You can get the list of “good tweets” by searching chats with “GT”.

To get list of users, messages or chats, Bot works well. HameSlack has integration for it. Register a bot on slack and enter API token on WP admin screen, that’s all.

Bot can interact Slack API easily. In this case, we need channels.histroy endpoint. Notice that this api’s channel parameter means channel id(e.g. CX92810), not channel name(e.g. general). Don’t worry, HameSlack has short cut for this. Let’s see the code below.