function slack_rules_send_message_action in Slack 7
Same name and namespace in other branches
- 6 slack.rules.inc \slack_rules_send_message_action()
Rules action for sending a message to the Slack.
1 string reference to 'slack_rules_send_message_action'
- slack_rules_action_info in ./
slack.rules.inc - Implements hook_rules_action_info().
File
- ./
slack.rules.inc, line 121 - Slack integration module rules functions.
Code
function slack_rules_send_message_action($webhook_url, $channel, $username, $message, $type_token = '', $emoji = '', $icon = '', $color = '', $pretext = '', $title = '', $title_link = '', $image_url = '', $author_name = '', $author_link = '', $author_icon = '', $footer = '', $footer_icon = '', $ts = '') {
if (!$webhook_url) {
$webhook_url = slack_get_default_webhook_url();
}
if (!$channel) {
$channel = slack_get_default_channel();
}
if (!$username) {
$username = slack_get_default_username();
}
if (!$type_token) {
$type_token = slack_get_default_icon_type();
}
if (!$emoji) {
$emoji = slack_get_default_icon_emoji();
}
if (!$icon) {
$icon = slack_get_default_icon_url();
}
$attachment_options = array();
if (!$color) {
$color = slack_get_default_attachment_color();
}
if (!$pretext) {
$pretext = slack_get_default_attachment_pretext();
}
if (!$title) {
$title = slack_get_default_attachment_title();
}
if (!$title_link) {
$title_link = slack_get_default_attachment_link();
}
if (!$image_url) {
$image_url = slack_get_default_attachment_image_url();
}
if (!$author_name) {
$author_name = slack_get_default_attachment_author_name();
}
if (!$author_link) {
$author_link = slack_get_default_attachment_author_link();
}
if (!$author_icon) {
$author_icon = slack_get_default_attachment_author_icon();
}
if (!$footer) {
$footer = slack_get_default_attachment_footer();
}
if (!$footer_icon) {
$footer_icon = slack_get_default_attachment_footer_icon();
}
if (!$ts) {
$ts = slack_get_default_attachment_ts();
}
$attachment_options['color'] = $color;
$attachment_options['pretext'] = $pretext;
$attachment_options['title'] = $title;
$attachment_options['title_link'] = $title_link;
$attachment_options['image_url'] = $image_url;
$attachment_options['author_name'] = $author_name;
$attachment_options['author_link'] = $author_link;
$attachment_options['author_icon'] = $author_icon;
$attachment_options['footer'] = $footer;
$attachment_options['footer_icon'] = $footer_icon;
$attachment_options['ts'] = $ts;
$attachment_options['mrkdwn_in'] = slack_get_default_attachment_mrkdwn();
$icon_options = array(
'icon' => $icon,
'emoji' => $emoji,
'type' => $type_token,
);
slack_send_message($webhook_url, $message, $channel, $username, $icon_options, $attachment_options);
}