Integrator For Slack

WC Slack is an open source plugin for integrating WooCommerce and Slack. Messages are automatically posted to slack when a user registers, logs in or updates their account details.  More to come.

Basic slack integration for WooCommerce

Dependencies

Run composer install to create the autoloader

Usage

Functions

Post your own messages to slack.

Simple Message

wc_slack_message("Hello World!");

Advanced Message @see https://api.slack.com/messaging/composing/layouts#attachments

$post = get_post($id);

wc_slack_message("Post Update Event", [
        'color' => '#28a745',
        'title' => $post->post_title,
        'text' => "Time Stamp: " . date('Y-m-d D h:i:s a (e)') . "\nPost ID: " . $post->ID ."\Status: " . $post->post_status,
        'actions' => [
            [
                "type" => "button", 
                "name" => "view-post", 
                "text" => "View", 
                "url" => get_permalink($post)
            ]
        ]
]);