Slack Notifications for WooCommerce

The Slack Notifcations for WooCommerce extension by Kestrel brings your WooCommerce store into the heart of Slack channel conversations allowing you and your team to easily stay current on what’s happening in your store with minimal effort.

Requirements

↑ Back to top
  • WooCommerce 4.0+
  • PHP 7.0+
  • An account on Slack with a free or paid plan

Installation

↑ Back to top
  1. Download the extension from your WooCommerce.com downloads page
  2. Go to Plugins > Add New > Upload and select the .zip file you downloaded
  3. Click Install Now, and then click Activate

For more information on installing and managing plugins see here

Setup and Configuration

↑ Back to top

The Slack API now uses OAuth 2.0 to validate all connections.

If you had previously set up authenticated integrations (legacy tokens) these will continue to work, but are discouraged. Switching to OAuth 2.0 is recommended.

To migrate to the new OAuth 2.0 integration, delete the old API keys from your settings by clicking on Clear Key on the notice, and follow the instructions below. The migration will happen automatically.[/box]

To set up the connection between your WooCommerce store and Slack account, there are two steps:

  1. Create a Slack application in the Slack dashboard
  2. Connect your application via the WooCommerce Slack extension settings

Create a Slack App

↑ Back to top

Step 1: Create a Slack application in the Slack dashboard

Go to the Slack’s applications ( you may need to log in using your Slack.com credentials ) section and click on the “Create an App” button:

Upon logging and clicking the “Create an App” button, you will be presented with the following screen asking how you’d like to create the app, either From scratch or From an app manifest, please select From Scratch (no code required):

In the next screen, fill in the form, then click Create App:

  • App Name – this is the name of your application, choose a name that is easy to remember
  • Development Slack Workspace – Workspace to which the notifications should be sent

You might get a notification to configure the app in code using App Manifest (Beta), you can safely dismiss the notification:

Now all you need to do is scroll down a bit, where you’ll see App Credentials detail:

Your Slack application is now created. Don’t close this page yet you will need it for the next step.

Step 2: Connect your Slack application to WooCommerce

  1. Copy the Client ID, go back to your WooCommerce Slack admin settings page
    • Paste it into the Client ID field
  2. Next, go back to your Slack application and click Show under Client Secret.
    • Copy the secret and paste it in the Client Secret field
  3. Scroll down and click “Save changes”

As a note, if you are installing the Slack extension for the first time, you will see this screen:

WooCommerce Slack extension new installation screen

You should now see that the “Connect with Slack” button is now Active – but before you click the button you must set permissions for the application, explained below.

WooCommerce Slack extension showing Connect with Slack button

To set permissions, for the application, navigate to “OAuth & Permissions” from the menu on the left on the Slack dashboard.

Copy and paste the Redirect URL into the Redirect URLs field, then click Add New Redirect URL (in the above example is https://core.doug.press/wc-api/wc_slack/) and click Save URLs.

Now you can go back to the previous Slack setting on WooCommerce and click Connect with Slack.

You should see the following screen:

 

After clicking “Allow” you will be taken back to the WooCommerce Slack settings page that will confirm the status of the connection with “Successfully authenticated” and the button changed to “Disconnect”.

Extension setup

↑ Back to top

With the site authenticated with your Slack account, more details and settings are presented to set up the extension to your needs:

WooCommerce Slack extension full settings after Authentication

To proceed with setting up WooCommerce Slack on your site, click on “Reload Available Channels” at the bottom – This will refresh the Channel list from your Slack workspace.

  1. Default Channel(s) – Choose a Channel or Channels for notifications to be sent under the “Default Channel(s)” option.
  2. Default Emoji. More info in the Emojis section below.
  3. Sender Name – by default, this is your site name.
  4. Debug mode – debug logs are stored when the “Enable Debug Mode” box is checked
    • This is useful for troubleshooting purposes. Otherwise, leave it disabled.
    • Logs are found via WooCommerce > Status > Logs.
  5. Notification Events
    • Select preferences for seven Notifications. More info in the Notifications section below.
  6. Send Test – clicking “Send Test Notification” will send a Test Message to the Channel(s) selected under Default Channel(s).
    • More details in the Testing section below.
  7. Select Reload channels if you have added new channels to Slack and they’re not showing.

Emojis

↑ Back to top

Slack allows you to use any of the many emojis available. If an emoji exists in your Slack Workspace then the code can be used here. You can find the shortcodes via a site like Emoji Searcher. They can also be used as your notification “icons”!

Note that Slack has a 5 minute lock on icons, which means if you have different icons set up for different notifications, you will only see the icons as long as the notifications are 5+ minutes apart. If not, the new notification will be nested under the old icon.

Set a default one:

You can also set different emojis for specific notifications:

Custom Emojis

Slack has a feature to add Custom Emoji that can be used in your account’s chat and in WooCommerce Slack.

Assign a new shortcode to use the emoji, like :woocart:, and then use it in your WooCommerce Slack settings!

How to add a custom emoji to Slack

Notifications

↑ Back to top

There are seven (7) notification events that can be enabled. All notifications have options that appear after being enabled. All are optional:

  • Channel – Specific channel to send this notification to
  • Emoji – Specific emoji of this notification
  • Custom Notification Message – Custom message to use for this notification, made using the notification’s unique template tags
  • Extended NotificationSome notifications, have the option to send more detailed, several row notifications (like new order notifications with line item information).

The default options for each notification

New Order Notification

There is also an extra option for the new order notification:

  • Free Orders – If you select this option, notifications are also sent for free orders.

Custom Notifications

It’s possible to build your own custom notification messages for each notification type. Underneath each notification, the available template tags are listed. They’re straightforward to use but keep in mind that {xxxxx_link} provides the URL itself. Special ‘Slack Formatting’ is allowed, like:

  • Bold: Wrap in *. eg. *some bold text*
  • Italic: Wrap in _. eg. _some italic text_
  • Links: Wrap in [[ & ]], with the format [[url|text to display]]. eg. [[https://woocommerce.com/|just view the Woo website!]]

Testing

↑ Back to top

To send a Test Notification, go to WooCommerce > Settings > Integration > Slack and click the Send Test Notification button. This will send a test notification to the Default Channel(s).

WooCommerce Slack extension test notification

Frequently Asked Questions

↑ Back to top

I added/removed a channel from my Slack account, but it’s not showing up.

↑ Back to top

To save your site resources, the extension caches your Channels. Click the Reload Available Channels button at the bottom of the settings page and any changes will show in the Channel list:

WooCommerce Slack extension reloading channel list

Customization

↑ Back to top
Note: We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance.

There are many filters that can be used to customize the extension and its notification messages:

includes/class-wcslack-events.php:			$allowed_post_types = apply_filters( 'wcslack_post_publish_types', array( 'post', 'page' ) );
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_new_post_prefix', __( 'New Post:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$author_name = apply_filters( 'wcslack_new_post_author', esc_attr( $author_data->display_name ) );
includes/class-wcslack-events.php:			$title = apply_filters( 'wcslack_new_post_title', get_post_field( 'post_title', $post->ID ) );
includes/class-wcslack-events.php:			$post_content =apply_filters( 'wcslack_new_post_content', get_post_field( 'post_content', $post->ID ) );
includes/class-wcslack-events.php:			$url = apply_filters( 'wcslack_new_post_url', esc_url( get_permalink( $post->ID ) ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_new_post_message', $message );
includes/class-wcslack-events.php:			$fields = apply_filters( 'wcslack_new_post_attachment', array(
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_new_order_prefix', sprintf( __( 'New Order #%d:', 'woocommerce-slack' ), $order_id ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_new_order_message', $message );
includes/class-wcslack-events.php:			$fields = apply_filters( 'wcslack_new_order_attachment', array(
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_back_order_prefix', __( 'Back Order:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_back_order_message', $message );
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_low_stock_prefix', __( 'Low on Stock:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_low_stock_message', $message );
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_out_stock_prefix', __( 'Out of Stock:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_out_stock_message', $message );
includes/class-wcslack-events.php:			$reviewer = apply_filtes( 'wcslack_new_review_reviewer_name', $comment_data->comment_author );
includes/class-wcslack-events.php:			$product_name = apply_filters( 'wcslack_new_review_product_name', $product_data->post_title );
includes/class-wcslack-events.php:			$rating_star = apply_filters( 'wcslack_new_review_rating_star', ':star:' );
includes/class-wcslack-events.php:			$review_content = apply_filters( 'wcslack_new_review_content', $comment_data->comment_content );
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_new_review_prefix', __( 'New Review:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$url = apply_filters( 'wcslack_new_review_url', get_comment_link( $comment_data ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_new_review_message', $message );
includes/class-wcslack-events.php:			$fields = apply_filters( 'wcslack_new_review_attachment', array(
includes/class-wcslack-events.php:			$user_name = apply_filters( 'wcslack_new_customer_name', $user_data->display_name );
includes/class-wcslack-events.php:			$prefix = apply_filters( 'wcslack_new_customer_prefix', __( 'New Customer:', 'woocommerce-slack' ) );
includes/class-wcslack-events.php:			$url = apply_filters( 'wcslack_new_customer_url', esc_url( admin_url( 'user-edit.php?user_id=' . $customer_id ) ) );
includes/class-wcslack-events.php:			$message = apply_filters( 'wcslack_new_customer_message', $message );
includes/class-wcslack-events.php:			$_product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
includes/class-wcslack.php:                             $locale = apply_filters( 'plugin_locale', get_locale(), $domain );
includes/class-wcslack-slack.php:			$user = ( $wrapper['name'] ) ? $wrapper['name'] : apply_filters( 'wcslack_message_username', get_bloginfo( 'name' ) );

Questions and Support

↑ Back to top

Have a question before you purchase? Please fill out this pre-sales form. Already purchased and need some assistance? Get in touch with a Happiness Engineer via the Help Desk.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.