Send an SMS when hitting a certain priority level in RequestTracker

RequestTracker is a widely used tool in many companies as it allows one to implement an effective workflow to handle any kind of events: customer requests, bug resolution etc…the requests are all filed as tickets to be resolved and put into queues.

RT also has a notion of priority levels for tickets, ranging from 0 to 100 and it supports scripting to automate some tasks. RT does a lot of things actually, but it’s a bit of a scary beast at first, with a not-so-clear documentation.

One need we have at my company is to be able to automatically send SMS notifications to some people when tickets with certain priority levels are filed in a certain queue, or when a ticket is escalated from a low to a medium/high priority.

Not knowing the RT Scrip language (yes, the call scripts scrip), it took my a couple of hours to figure out and test a working solution to handle this case. To avoid a waste of time to other people, here is a working solution…note that I’m using the RT 3.8 branch.

Step 1: chose an SMTP to SMS provider

To be able to send SMS messages, you obviously need some kind of gateway between the e-mail RT is able to send and your mobile phone. Many companies are offering SMTP to SMS services…I use Clickatell but you can use whoever you want by mildly tweaking the following steps.

Step 2: configure a Template in RT

This Template contains what you will see in the SMS message (the “text:” parts) as well as specific information needed to authenticate to the Clickatell SMS gateway. All “to:” lines are phone numbers to send the SMS to.

Configuration > Global > Templates > New
Name: SMS-XXX-Queue
Description: SMS template for the XXX queue
Content:
To: sms@messaging.clickatell.com

user:<you clickatell username>
password:<you clickatell password>
api_id:<you clickatell API ID>
to:xxxxxxxxxx
to:xxxxxxxxxx
text:Medium/High priority ticket filed!
text:{$Ticket->QueueObj->Name}: {$Ticket->Subject}
text:URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}

Step 3: configure a Scrip in RT to send the SMS using the Template

I’m having 3 priority levels here, 0 (Low), 50 (Medium) and 100 (High). This Scrip sends an SMS as soon as a 50 or 100 priority level ticket is filed or escalated to, it also nicely handles transitions between states. The “XXX” corresponds to the RT queue name you wish the Scrip to apply to.

Configuration > Global > Scrips > New
Description: SMS – XXX queue
Condition: User Defined
Action: Notify Other Recipients
Template: Global template: SMS-XXX-Queue
Stage: TransactionCreate
Custom condition:
if (($self->TransactionObj->Field eq ‘Priority’ && $self->TicketObj->Priority >= 50 && $self->TransactionObj->NewValue > $self->TransactionObj->OldValue && $self->TransactionObj->OldValue != 50 && $self->TicketObj->QueueObj->Name eq “XXX”) || ($self->TransactionObj->Type eq ‘Create’ && $self->TicketObj->Priority >= 50 && $self->TicketObj->QueueObj->Name eq “XXX”)) {
return(1);
}
else {
return(undef);
}
Custom action preparation code
:
return 1;

That’s it, you have working SMS notifications for your XXX queue now!

Leave a Reply