[rt-users] Slack integration?

Tim Bishop tim at bishnet.net
Fri Jun 12 08:42:38 EDT 2015


On Fri, Jun 12, 2015 at 08:18:39AM -0400, Konstantin Ryabitsev wrote:
> On 11/06/15 08:10 AM, Tim Bishop wrote:
> > Hi Josh, Konstantin,
> > 
> > Just wondering if either of you pursued this, or possibly created your
> > own solution?
> 
> Nope, sorry, didn't have enough cycles on the team to get this done.

I got something very basic working as a proof of concept, but I don't
think I've got the interest to take it further. But for the benefit of
the list archives here it is. I put this in the cleanup code section of
a Scrip.

Tim.

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use JSON;

my $ticket = $self->TicketObj->id;
$ticket = "<https://my.rt.url/$ticket|#$ticket>";
my $subject = $self->TicketObj->Subject;
my $description = $self->TransactionObj->Description;

my $data = { 'text' => "Ticket updated: $ticket - $subject\n$description." };

my $ua = LWP::UserAgent->new;
$ua->timeout(15);

my $req = POST("https://hooks.slack.com/services/...", ['payload' => encode_json($data)]);

my $resp = $ua->request($req)->as_string;

-- 
Tim Bishop
http://www.bishnet.net/tim/
PGP Key: 0x6C226B37FDF38D55




More information about the rt-users mailing list