Getting the call from Twilio but it's not reading the message

Saurav Bhardwa2
Tera Contributor

I have using this code, it is making the call to twilio but it's not reading the text. May I know what I am doing wrong here?

Hello, 

I have configured the Twilio and SNOW connection. I am able to get the call from twilio but it's not reading the text message that I have provided him in the code

var x = new GlideRecord('incident');
x.get('79c681211ba93514713762007e4bcb55');
var list = x.getValue('watch_list');

var list1 = list.split(',');
gs.info(list1);
var arr = [];
for (var i = 0; i < list1.length; i++) {
    var user = new GlideRecord('sys_user');
    if (user.get(list1[i])) {
        gs.info(user.getValue('mobile_phone'));
        var numbers = user.getValue('mobile_phone');
        var from = '';
     
       


var notifyAction = new SNC.NotifyAction();

// add a say action to say something in US English
var usSay = notifyAction.addSay();
usSay.setText('Welcome. I can speak english');
usSay.setLanguage('en-US');

gs.info(new SNC.Notify().call(from, numbers));
    }
   
}


May I know how to achieve this functionality?
3 REPLIES 3

Peter Bodelier
Giga Sage

I'm not completely sure, but I think you are trying to use 2 different API together.

 

I'd say the script should be something like this:

var x = new GlideRecord('incident');
x.get('79c681211ba93514713762007e4bcb55');
var list = x.getValue('watch_list');

var list1 = list.split(',');
gs.info(list1);
var arr = [];
for (var i = 0; i < list1.length; i++) {
    var user = new GlideRecord('sys_user');
    if (user.get(list1[i])) {
        gs.info(user.getValue('mobile_phone'));
        var numbers = user.getValue('mobile_phone');
        var from = '';
     
       


var notifyAction = new SNC.NotifyAction();

// add a say action to say something in US English
var usSay = notifyAction.addSay();
usSay.setText('Welcome. I can speak english');
usSay.setLanguage('en-US');

var dialAction = notifyAction.addDial();
 
// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial
dialAction.setPhoneNumber(numbers);


    }
   
}

Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

No, it did not work. I will have to mention Twilio number as well in the from Variable

 

26stabassum
Tera Contributor

I found the solution. If you are still looking for it. I tried this and it worked

https://www.servicenow.com/community/developer-forum/how-to-enable-voice-call-through-twilio-to-serv...