Blog

Phone Callback using ServiceNow Web Services

360211-apple-iphone-5-at-t.jpg

There are many possible ways to do phone callbacks via automated text-to-speech technology. One of these ways is to write some ServiceNow code to connect to an external paid webservice that calls users.

In this article, I am going to discuss a possible callback system using CDYNE Phone Notify webservices.

Configure SOAP Message for CDYNE Phone Notify

  1. Go to the CDYNE website and sign up for an account
    http://www.cdyne.com/api/phone/notify/
  2. In ServiceNow, Go to System Webservices > Outbound > SOAP Message
  3. Click New
  4. Configure the Outbound SOAP Message
    Name: CDYNE Phone Notify
    WSDL: http://ws.cdyne.com/NotifyWS/PhoneNotify.asmx?wsdl

     

  5. Click Save to save the Outbound SOAP Message.
  6. Click Generate SOAP Messages

Test Connection

  1. In ServiceNow, Elevate your Privilege to security admin

 

2. In the Left Navigator, click Scripts - Background

3. Run this script, while substituting values as needed :

//Substitute values as needed <substitute>
phoneNotify();
function phoneNotify() {
 var s = new SOAPMessage('CDYNE Phone Notify', 'PhoneNotifySoap.NotifyPhoneBasic'); 
 s.setParameter('PhoneNumberToDial','<substitute>');
 s.setParameter('TextToSay','Mike Kaufman has called you.Please return this call. It is disappointing when you do not call back. CALL IMMEDIATELY NOW.');
 s.setParameter('CallerID','<substitute>');
 s.setParameter('CallerIDname','Mike Kaufman');
 s.setParameter('VoiceID','0');
 s.setParameter('LicenseKey', '<substitute>');
 var response = s.post();
 gs.print(response);
}

4. In the Left Navigator, click Scripts - Background

5. Run this script, while substituting values as needed :

UI Action

 

name: Caller Notify
Table: Incident
Form context menu: true
Condition: !current.caller_id.phone.nil()
Script:
phoneNotify();
function phoneNotify() {
 action.setReturnURL(current);
 action.setRedirectURL(current);
 var s = new SOAPMessage('CDYNE Phone Notify', 'PhoneNotifySoap.NotifyPhoneBasic');
 s.setParameter('PhoneNumberToDial', current.caller_id.phone);
 var msg = current.caller_id.name +' has called you.Please return this call. It is disappointing when you do not call back. CALL IMMEDIATELY NOW.' ;
 s.setParameter('TextToSay',msg);
 s.setParameter('CallerID','<substitute>');
 s.setParameter('CallerIDname','<substitute>');
 s.setParameter('VoiceID','2');
 s.setParameter('LicenseKey', '<substitute>');
 var response = s.post();
 gs.addInfoMessage(response);
}

6. UI Action in ServiceNow Incident

name: Caller Notify
Table: Incident
Form context menu: true
Condition: !current.caller_id.phone.nil()
Script:
phoneNotify();
function phoneNotify() {
 action.setReturnURL(current);
 action.setRedirectURL(current);
 var s = new SOAPMessage('CDYNE Phone Notify', 'PhoneNotifySoap.NotifyPhoneBasic');
 s.setParameter('PhoneNumberToDial', current.caller_id.phone);
 var msg = current.caller_id.name +' has called you.Please return this call. It is disappointing when you do not call back. CALL IMMEDIATELY NOW.' ;
 s.setParameter('TextToSay',msg);
 s.setParameter('CallerID','<substitute>');
 s.setParameter('CallerIDname','<substitute>');
 s.setParameter('VoiceID','2');
 s.setParameter('LicenseKey', '<substitute>');
 var response = s.post();
 gs.addInfoMessage(response);
}

Testing

1. Right Click > Caller Notify

2. Response Message from CDYNE