Skip to content

Instantly share code, notes, and snippets.

@dmnlk
Created September 16, 2014 06:05
Show Gist options
  • Select an option

  • Save dmnlk/28e74cb78e206f905efb to your computer and use it in GitHub Desktop.

Select an option

Save dmnlk/28e74cb78e206f905efb to your computer and use it in GitHub Desktop.
SlackにPostするなんか
#!/usr/bin/perl
use utf8;
use strict;
use warnings;
use Encode 'decode';
use Encode 'encode';
use JSON qw(encode_json);
my $dir = $ARGV[0];
my $errors = $ARGV[0];
$errors = decode('UTF-8', $errors);
#exit 1 if $errors eq '';
my $url = 'https://hoge.slack.com/services/hooks/incoming-webhook?token=XXXXXXXXXXXXXXXXXXXX';
my $payload = {
"channel" => "#tekitouchanel",
"text" => $errors,
"icon_url" => "imageUrl",
};
system 'curl', '-X', 'POST', '--data', sprintf("payload=%s", encode_json($payload)), $url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment