steverobbins/magento-slack

Magento integration with Slack.com

Installs: 488

Dependents: 0

Suggesters: 0

Security: 0

Stars: 16

Watchers: 3

Forks: 4

Open Issues: 1

Type:magento-module

v1.0.0 2015-07-28 21:29 UTC

This package is auto-updated.

Last update: 2024-10-29 05:04:36 UTC


README

Build Status Scrutinizer Code Quality

*Note: This module doesn't do much on it's own. It's just an api wrapper for integrations you write. You can use it chat to your Slack channel when: an order is placed, and exception is logged, an account is created, etc.

Config

image

  • In Slack: Create a bot under "Integrations" in the
  • In Magento: Under System > Config > Services > Slack, enable the module and add your token
  • Click Save
  • Click Get Channels to collect your channels and their identifiers

API Usage

Review the methods in Slack's API.

Invoke with:

Mage::getModel('slack/api_<method>')
	->setFooArg('bar')
	-><action>();

For instance:

Chat "Hello World" to the #general Channel

$chat = Mage::getModel('slack/api_chat');

$chat->setChannel('general')
    ->setText('Hello World');

$chat->postMessage();

var_dump($chat->getData());

Notice you use the channel name, not it's identifier.

Upload a File

Mage::getModel('slack/api_files')
    ->setChannels(array('general', 'random'))
    ->setContent(file_get_contents($someFile))
    ->upload();

etc.