Skip to content

Commit

Permalink
just some adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
htrgouvea committed Nov 28, 2024
1 parent 9c27e5e commit 376ca5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Sentra/Engine/SlackWebhook.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ package Sentra::Engine::SlackWebhook {
my $userAgent = Mojo::UserAgent -> new();
my $payload = encode_json({text => $message});

my $tx = $userAgent -> post($webhook => {
my $text = $userAgent -> post($webhook => {
'Content-Type' => 'application/json'
} => $payload);

my $res = $tx -> result;
my $res = $text -> result;

unless ($res) {
my $err = $tx->error;
my $err = $text -> error;
return "Failed to send message: [" . ($err->{message} || "Unknown error") . "]\n";
}

return "Failed to send message: [" . $res->message . "]\n" unless $res->is_success;
return "Failed to send message: [" . $res->message . "]\n" unless $res -> is_success;

return "Message sent successfully! [" . $res->body . "]\n";
}
Expand Down

0 comments on commit 376ca5b

Please sign in to comment.