Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize slack channel #1

Merged
merged 2 commits into from
Jul 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.pl-dist
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ $notify = {
'push_paused' => 0,
'push_resumed' => 0,
'webhook_url' => 'https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXX/XXXXXXXXXXXXXXXXX', #webhook url
'channel' => '', # '@myuser', '#notifications', etc. '' uses default channel configured in the Slack webhook
'message' => '{user}',
},

Expand Down
1 change: 1 addition & 0 deletions config.pl-dist-win32
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ $notify = {
'push_paused' => 0,
'push_resumed' => 0,
'webhook_url' => 'https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXX/XXXXXXXXXXXXXXXXX', #webhook url
'channel' => '', # '@myuser', '#notifications', etc. '' uses default channel configured in the Slack webhook
'message' => '{user}',
},

Expand Down
7 changes: 6 additions & 1 deletion plexWatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
'backup',
'clean_extras',
'show_xml',
'slack_channel:s',
'help|?'
) or pod2usage(2);
pod2usage(-verbose => 2) if (exists($options{'help'}));
Expand Down Expand Up @@ -2366,7 +2367,9 @@ ()
$sk{'message'} .= ' ' . ucfirst($alert_options->{'item_type'}) if $alert_options->{'item_type'};
$sk{'message'} .= ' ' . $alert;

my %post = ('text' => $sk{'message'});
my $channel = $sk{'channel'};
if ($options{'slack_channel'}) { $channel = $options{'slack_channel'}; }
my %post = ('text' => $sk{'message'}, 'channel' => $channel);
my $json = encode_json \%post;
my $url = $sk{'webhook_url'};

Expand Down Expand Up @@ -4389,6 +4392,8 @@ =head1 SYNOPSIS

--exclude_library_id=... Full exclusion for a library section id. It will not log or notify.

--slack_channel Slack channel or user override to notify. '--slack_channel=#notifications', '--slack_channel=@myuser'

#############################################################################################

--format_options : list all available formats for notifications and cli output
Expand Down