sub get_slack_name {
my ($ua, $userid) = @_;
my $req = HTTP::Request->new('GET', 'https://slack.com/api/users.info?user=' . $userid, [
- 'Authorization' => 'Bearer ' . $config::oauth_token
+ 'Authorization' => 'Bearer ' . $config::slack_oauth_token
]);
my $response = $ua->request($req);
die $response->status_line if !$response->is_success;
'https://slack.com/api/conversations.open',
Content => JSON::XS::encode_json({ users => [ $userid ] }),
Content_type => 'application/json;charset=UTF-8',
- Authorization => 'Bearer ' . $config::oauth_token
+ Authorization => 'Bearer ' . $config::slack_oauth_token
);
die $response->status_line if !$response->is_success;
'https://slack.com/api/chat.postMessage',
Content => JSON::XS::encode_json({ channel => $channel_id, text => $msg }),
Content_type => 'application/json;charset=UTF-8',
- Authorization => 'Bearer ' . $config::oauth_token
+ Authorization => 'Bearer ' . $config::slack_oauth_token
);
my $msg_json = JSON::XS::decode_json($response->decoded_content);
die "Something went wrong: " . $response->decoded_content if (!defined($msg_json) || !$msg_json->{'ok'});