- Core plugin installation
- Install addons
- Configure- Create Slack post
- Configure- Configure Slack Post
- Configure- Test Webhook
- Configure- Events
- Extending CBX WP Slack(Hooks and Filters)
- Outgoing Slack Webhook
- Extending CBX WP Slack Outgoing(Hooks and Filters)
Core plugin installation
This plugin’s core version is free and can be install from
wordpress plugin directory
Plugins can be installed in different ways in wordpress. As wordpress codex has very well
documentation about this, we are recommending to read that
Pro addons need to install manually. The way we provide the download zip either you will get all plugins in single zip file having name _all.zip at end or individual zip of each plugin. For the first way if all plugins are in one single folder cbxwpslackaddon.zip then unzip it and you will find the core and addons. Now either zip individual plugin and upload from wordpress plugin upload manager or directly upload via ftp. Whatever the way you upload after install if you check via ftp to your wordpress plugin dir then it should look like this
Configure- Create Slack post
See the menu called “CBX WPSlack” at left side menu panel, click it. You if you creating any new post first time then you will see the post list empty. Let’s create one.
A typical slack post setting should look like this
Configure- Configure Slack Post
For a minimal setup you need to put
- Service Url: We have a nicely written step by step guide for this in our another network site for joomla extensions. Read that and back here again for now.
- Channel: example #general, if you are a slack user then you know this better.
- Username: As you want to show name in slack as post/bot
- Imoji: example :ghost:
- Test: Save the post and click the test button from right side. If everything is fine then you should see a notification in slack in your configured channel.
Configure- Test Webhook
Each slack post can have multiple events, events are loaded few with core plugin and from 3rd party addons or from our pro addons more events are added. See this below figure, here we checked new post publish notification and let’s see.
Hooks & Filters
Direct Notification sending
If this plugin is active you can send direct slack notification using this method
Creating hooks with simple message
Creating hooks with callback method/closure as dynamic message
Outgoing Slack Webhook
slack outgoing webhook is another interesting integration for slack with any 3rd party. In this plugin we implemented a system that can be extended as need.
How it works ? suppose you type something special keyword and then rest in a slack channel, then slack sends this query to a specific url, if that url responds with any text slack shows it >> this is how slack outgoing api works.
What we have done for this ?
Outgoing webhook is also custom post types, can be access from CBX WPSlack menu from left side of wordpress admin panel.
CBX WPSlack outgoing webhook has event types, it’s current builtin event is “postsearch” (though advance user can extended it and add more events)
How to implement “Post Search” event
1. Login to your slack team, as example your slack team should be a url something like this https://example.slack.com (where example is team domain)
2. Go here https://example.slack.com/apps/manage/custom-integrations and click outgoing. BTW, if you don’t see outgoing app there that means you need to search app directory for “outgoing” and add the outgoing app at first, this same way as you added the incoming webhook app. If you are a advance slack user then you will find many other ways to reach slack outgoing webhook app configuration page. If you reach configuration page correctly then you should see this screen.
Now back to WordPress admin and go for creating a new post of type “CBX WPSlack Out” and you should see screen like below
You will need to copy token from slack app configuration to wordpress and copy url from wordpress to slack app
Extending CBX WP Slack Outgoing(Hooks and Filters)
CBX WPSlack Out post types has some action and filter
1. custom event hook
Filer name “cbxwpslackout_events” which gets an array as input
For each event the
Hope you got it :)