Is there a way to create a notification block that will ignore a user’s schedule when sending notifications?
I am wanting to create a high-priority notification pipeline that will call a small number of key personnel regardless of their schedules. I’d like to retain the schedules on the users for the run-of-the-mill alerts though.
I think I can do this with a scripted roster, but I didn’t know if there was some simple property I was missing to let me do this a bit easier.
rosters = system.alarm.getRosters()
users = rosters.get("Emergency Call")
scriptedRoster = []
for person in users:
user = system.user.getUser("default",person)
userContactInfo = user.getContactInfo()
phoneNumbers=[]
emailAddresses=[]
smsNumbers=[]
for item in userContactInfo:
if item.contactType == 'phone':
phoneNumbers.append(item.value)
if item.contactType == 'email':
emailAddresses.append(item.value)
if item.contactType == 'sms':
smsNumbers.append(item.value)
rosterEntry = {"username":person, "firstname":user.get(user.FirstName), "lastname":user.get(user.LastName)}
if phoneNumbers:
rosterEntry["phone"] = phoneNumbers
if emailAddresses:
rosterEntry["email"] = emailAddresses
if smsNumbers:
rosterEntry["sms"] = smsNumbers
if not phoneNumbers:
break
scriptedRoster.append(rosterEntry)
return scriptedRoster
It pulls the user list for a specific roster name from the overall roster list, then gets the relevant info for each user. In my case, I was only wanting users that had a phone number configured, so I added a break to the loop before the script adds the completed user to the array. If you want all the users from a roster, just remove that section.