Notify Slack
Categories
Component ID
2535962
Component name
Notify Slack
Component type
module
Maintenance status
Development status
Component security advisory coverage
covered
Downloads
1274
Component created
Component changed
Component body
Send message to Slack
This module is designed for web-developer/ops. Using Incoming WebHooks to send messages to slack for notifying. It's very easy to set notifier in follow steps:
How to use
- Go to Slack services page.
https://projectname.slack.com/services/new - Choose Incoming WebHooks.
https://projectname.slack.com/services/new/incoming-webhook - Pick any channel.
Note: You could input others in this module/function. - Copy Webhook URL to this module's settings page from Slack services page.
- Go to Drupal setting page to set defaults.
http://yoursite/admin/config/ucdapp/notify_slack - Congrats! Now you could use this module to send message to Slack.
Examples & Test
Test our feature as follow page:http://yoursite/notify_slack/form
Note: "Channel" field need to add "#" as prefix value.
Example code:
<?php
// Send message by passing only strings.
notify_slack("Your messages");
// Send with Slack settings.
notify_slack(array(
'link_names' => 1, // 1: To show your mentions as a link; 0: is opposite.
'username' => 'Shrek', // Slackbot custom name to instead.
'icon_emoji' => ':ghost:', // Bot avatar. could be Emoji or image's url.
'channel' => '#random', // The channel you want to send.
'text' => "Your messages.", // Passing strings as you message to notify slack.
));
?>
The function notify_slack could be use in some errors and users feedback to notify Ops as well.
Now you can enjoy what is email-free feel like. Cheers!
