Magento Slack Integration
, (*1)
*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., (*2)
Config
, (*3)
- 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., (*4)
Invoke with:, (*5)
Mage::getModel('slack/api_<method>')
->setFooArg('bar')
-><action>();
For instance:, (*6)
$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., (*7)
Mage::getModel('slack/api_files')
->setChannels(array('general', 'random'))
->setContent(file_get_contents($someFile))
->upload();
etc., (*8)