Perl から Slack の incoming-webhook 宛にメッセージを飛ばす
あっさりできてしまった。
#!/usr/bin/env perl use strict; use warnings; use URI; use HTTP::Tiny; use JSON qw/encode_json/; my $url = URI->new('slackのincoming-webhookのURL'); my $ht = HTTP::Tiny->new; # リクエストに必要なHTTPヘッダーを組み立て my $header = { headers => { 'Content-Type' => 'application/json; charset=utf-8', }, content => encode_json { text => "test text", }, }; my $response = $ht->request( 'POST', $url, $header ); print "$response->{status} $response->{reason}\n";