Notify Outbound Calls Through Twilio - Identify the Originating Task from Call Workflow/Record?

Ben Vargas
Tera Guru

I am looking to enhance the ServiceNow "On-Call: Assign by Acknowledgement" workflow to also support calling the on-call individual's sms phone if they've so opted in their profile; the thought being it would read them the task short description and then prompt "1 to acknowledge or 2 to reject".

I have used the "Call" Workflow Activity provided by Notify and the workflow does trigger a call to the on-call's phone and successfully says "Hello World" via the workflow triggered by the 'Outgoing call workflow' on the number group. It appears that while the workflow runs, the notify_call record corresponding to the call is what is in scope as current, but there is no "source" field as there is with notify messages (notify_message).

So, has anyone solved for how to determine (and use data from) the task record from which the call was triggered? Right now I see no way of reading the contents of the task that triggered the call, or even knowing which task to acknowledge or reject when prompting the user for input.

ServiceNow 2017-03-31 09-44-32.jpg

ServiceNow 2017-03-31 09-46-01.jpg

1 ACCEPTED SOLUTION

Ben Vargas
Tera Guru

The HI Support INC has made it's way through Support and up to the dev team who advised that this is a platform limitation and would require an enhancement request... we will simply have to offer a generic "wake-up call" that a user has an SMS they need to respond to, but not actually gather accept/reject via the phone call.



Definitely unfortunate, these java libraries should be developed with similar capabilities... as of now Notify can't quite compete with PagerDuty or xMatters in terms of call processing/smarts as even though we have workflow control on calls, there is no link to the task that created it.



Details on the case...



We reviewed your use case with the on-call development team and they have provided us the answers . That is , 'call' activity definition in the workflow which creates notify_call record in the java layer does not have source column field defined . So , it is not populated . This seems to be an product enhancement .



I am still checking with the notify team if there is any workaround . I will update you , as soon as i hear from them .




On - Call Schedule Dev team's reply :



-------------------------------------------------



Firstly "notify_call" table doesn't have the column "source" to point back to the task that created this call record.



seems like the issue is not with the on-call workflow but the activity it is using "Call Escalatee" which internally using the Activity definition "call".



on-call workflow is just using the "call" activity definition to initiate the call which internally creates notify_call records.



upon digging into the source code found that in NotifyDatabase.java



addMessageRecord() - is used to create notify_message records and have "source" as a parameter.



addCallRecord() - is used to create notify_call records and doesn't have any "source" as a parameter.



I don't think issue is with the workflow but with the activity definition.


View solution in original post

17 REPLIES 17

ashwinkumar_pat
Giga Expert

Hello Ben



If I understood your question right, what you are trying to achieve is read the field values of task record and include those in your message.



The workflow "On-Call: Assign by Acknowledgement" runs on Task table and you should be able to use current.<field id> (e.g. current.short_description) in this workflow and pass it as input to "outgoing call workflow" and use it in Say



Here is the doc on workflow variables - Using variables in a workflow


and here is a relevant post - How to pass values from a from to a workflow that is inside another workflow



find_real_file.png



Hope that helps. The use case is very interesting. Please let me know how it all goes and would appreciate if you could do a doc or a video on this use case.




~@$h


Thanks for the response Ashwinkumar - The challenge is that when the Call Workflow Activity is invoked, it engages the SNC.Notify() library which is responsible for establishing the call with twilio (and creating the notify_call record). When the call is established, it runs the workflow defined on the Notify Number Group's "Outgoing call workflow". Therefore, the workflow being run is not the On-Call: Assign by Acknowledgement when the call is running; that is the one that triggered the call, but the other workflow attached to notify_call is what is running the say and input workflow activities to manage the call.



I don't see anywhere to "pass" the data I need to the SNC.Notify().call() method used by the Call workflow activity... do you have ideas on how to do that? The Call workflow activity doesn't directly call a workflow, so that's my challenge.



Screen Shot 2017-03-31 at 10.38.09 AM.png


Hello Ben



I dont have any records in notify_call table. Can you please do me a favor by attaching a sample record here including all the fields?


I am guessing the record in notify_call table may have a reference to base record against which notify.call() was issued.




find_real_file.png


Yeah, that's what I was hoping for too... similarly to how notify_message (for SMS messages) has a source field. The notify_call table does not... here's an xml with of one of the records (with numbers changed for privacy):



<xml>


<notify_call>


<active>false</active>


<calculated_name>+185838081111/calculated_name>


<call_id>CA73f37c2ad3e2d06c17d2df08d70cfd0b</call_id>


<client/>


<client_table/>


<direction>outbound</direction>


<is_human>true</is_human>


<last_action>


{"fClassName":"NotifyAction","fActions":[{"type":"SayAction","properties":{"fClassName":"SayAction","fLanguage":"en-US","fText":"Hello World!"}}]}


</last_action>


<notify_number display_value="+15039858999">01117e4f6f08320cdd3deec54b3ee4e8</notify_number>


<parent_call/>


<phone_number>+185838081111</phone_number>


<sys_created_by>system</sys_created_by>


<sys_created_on>2017-03-30 22:17:25</sys_created_on>


<sys_id>09fa12cedbf53600faca720ebf9619f4</sys_id>


<sys_mod_count>2</sys_mod_count>


<sys_updated_by>guest</sys_updated_by>


<sys_updated_on>2017-03-30 22:17:38</sys_updated_on>


<type>phone</type>


</notify_call>


</xml>