SMS Notification Mapping
- 1 Summary
- 2 Creating a SMS Notification Mapping
- 3 SMS Notification Mapping configuration options:
- 3.1 Name
- 3.2 Enabled
- 3.3 Projects
- 3.4 Issue Created
- 3.5 Issue Updated
- 3.6 Issue Deleted
- 3.7 SMS Transport
- 3.8 To Phone Numbers
- 3.9 JQL Whitelist
- 3.10 Velocity Script
- 4 Issue Data
- 5 Example Velocity TemplateSet Scripts
- 6 Related Articles
Summary
Like Email Notification Mappings, the SMS notification mapping is in charge of sending SMS messages from Issue events through the SMS Transport. Within these Notification mappings you can select the Phone Numbers that should be notified.
Creating a SMS Notification Mapping
Go to JEMH Cloud > Notifications > SMS > Create
Complete the form, select the nominated projects, select the SMS transport you want to use and the phone numbers (CSV) that will receive these SMS messages.
On Submit, you should see the new SMS mapping
SMS Notification Mapping configuration options:
Name
The Name of the Notification Mapping.
Enabled
Defines whether the Notification Mapping can be used.
Projects
This defines the Projects that the Notification Mapping will send notifications for. This can be either for the selected Projects or for all Projects.
Issue Created
The Template that is used to render Issue Created Notifications
Issue Updated
The Template that is used to render Issue Updated Notifications
Issue Deleted
The Template that is used to render Issue Deleted Notifications
SMS Transport
Defines the SMS transport in charge of sending these SMS messages.
To Phone Numbers
This is a CSV list of phone numbers that will receive SMS notifications
JQL Whitelist
This is a optional JQL filter. Only Issues matching this JQL expressions will receive notifications. E.g. issuetype = 'Bug' will only send bug notifications.
Velocity Script
This allows for custom conditions that will affect the sending of the notifications. For example inhibiting notifications or changing one of the parameters like the phone numbers. See below for some Example Velocity Scripts.
Issue Data
The Issue data that templates work with comes from Webhooks, it is a JSON structure that contains all issue data.
When you have a Notification Mapping scoped for a given project, events will start showing up in JEMHC > Auditing > Events. There is a '…' action button, under which you can Create Preview Context (see Preview Context ), this stores the event inside JEMHC to allow Template edit time preview. Note: the EVENT type (create/update/delete) must match the TemplateSet type (create/update/delete). See Manipulate webhook data in notification templates for more on working with that data.
Example Velocity TemplateSet Scripts
SMS notification behaviour can be changed at runtime with a user-defined SMS TemplateSet which uses the Velocity Template language, the basic syntax is not too hard to understand.
Once a Preview Context exists, when editing a TemplateSet of the right type, you can pick that context, and see it, and preview your template in the context of that data, so you can determine correct functionality before the template is made live. Making a template live means picking it inside the related SMS Notification config for the expected event (eg Create).
Some example scripts showing how to get values are below.
Reset/Add Phone Numbers
Change to phone number when Critical
#if ($context.issue.fields.priority.name.textValue() != 'Critical') ## if issue priority is critical
$smsNotificationUtils.resetToPhoneNumbers() ## remove existing phone numbers for current notification
$smsNotificationUtils.addToPhoneNumber("+1234567") ## add phone number to current notification
#end
|
Restrict notifications to specific time ranges
Notify only after hours
#if (!$dateTimeUtils.betweenHours("18:00", "06:00")) ## during specific hours
$smsNotificationUtils.inhibitNotification() ## prevent current SMS notification
#end
|
Restrict by priority
#if ($context.issue.fields.priority.name.textValue() != 'Blocker') ## if issue priority is not a blocker
$smsNotificationUtils.inhibitNotification() ## prevent current SMS notification
#end
Velocity Script cannot be validated at configuration time (for example the dynamic phone numbers). You should test the script by re-executing events in Auditing > Events