Legacy Dev Forum Posts

 View Only

Sign Up

Issues with passing custom data from an inbound call to embedded framework servicenow

  • 1.  Issues with passing custom data from an inbound call to embedded framework servicenow

    Posted 06-05-2025 18:49

    osands | 2020-01-14 19:15:27 UTC | #1

    I've followed all the documentation , I've read the post that is here in this forum yet I still cannot receive any custom attributes with in incoming call.

    I have this defined in my framework.js file that ive uploaded to purecloud:

    name:"ExampleGitHubApp", clientIds: { 'mypurecloud.com': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }, customInteractionAttributes: ["Skill1"], settings: {......

    We have defined that variable with the attribute name "Skill1"(test var) in the call flow as a " Participant Data action". we used this documentation to do that: https://help.mypurecloud.com/articles/set-participant-data-action/

    When I grab the event data that comes in for a message type of screen pop when the call comes in there is no attributes object in the data model that is coming over.

    I looked at the embedded-crm-pef-example online: window.addEventListener("message", (event) => { var message = JSON.parse(event.data);

    if(message){ // Screenpop Configuration if(message.type == "screenPop"){ console.log('===================================='); console.log(message);

    this.contactsService.interactionId = message.data.interactionId.id;

    let attributes = message.data.interactionId.attributes; let _urlpop, _searchvalue; if (attributes){ _urlpop = attributes[this.frameworkService.URLPopAttribute]; _searchvalue = attributes[this.frameworkService.SearchValueAttribute]; }

    When my event data comes over on an inbound call I get this:

    notification data = {"type":"screenPop","data":{"searchString":"+xxxxxxxxx","interactionId":{"id":"xxxxxxx-xxxxx-xxxxx-xxxxxxxxxxxxxxxx","phone":"tel:+xxxxxxxxxx","name":"xxxxxx xxxxxxxx","isConnected":false,"isDisconnected":false,"isDone":false,"state":"ALERTING","isCallback":false,"isDialer":false,"isChat":false,"isEmail":false,"isMessage":false,"isVoicemail":false,"remoteName":"xxxxxxx","recordingState":"active","displayAddress":"+xxxxxxxxxx","ani":"+xxxxxxxxx","calledNumber":"+xxxxxxxxx","direction":"Inbound","isInternal":false}}}

    as you can see the attributes data doesn't exist.

    Can someone give a clear cut example of what needs to be done on the pure cloud side and the embedded framework to have this attribute object on the event data???

    use case is : I simply want to send a case number that the caller is calling about over to the embedded framework implementation in servicenow so that I can look it up in servicenow when the call comes in.

    I am using a servicenow ui page in an openframe. I can get the interactionsubscription payload and look up data in service now based on the phone number coming in that subscription data but now I need to pass a casenumber as customattribute.


    Junji_Sawada | 2020-01-14 21:06:41 UTC | #2

    Hi Owen,

    If the value is not coming through to the client, please check the conversation data at /api/v2/conversations/{conversationId} endpoint (for example, by using API Explorer in Developer Tools) to see if the attribute you're looking for really exists on the conversation data. If it is not there, the call flow may not be setting attribute value correctly.

    Junji


    osands | 2020-01-15 15:23:36 UTC | #3

    Hello Junji, Thanks for the help! Ok I looked up the ID using he API call and I don't see that data on it. Is it possible to give a clear example of how to send custom data to a call on the pure cloud side of the equation? There seems to be very limited documentation surrounding this.

    One more interesting thing to note though is I see some sort of messages being logged to the JS console in the browser from the embedded widget. And from this you can see there are attributes and the variable is there but it never comes into any of the subscriptions on the page(ie message type=="screenPop", message type="interactionSubscription" etc......).

    9:20:41_343 AM => CP Message - conversations : {"topicName":"v2.users.8e69ac0e-1e9b-4e0c-9ecc-fe7708904d76.conversations","version":"2","eventBody":{"id":"ec362311-3a51-43cb-8d78-3dc965a866c5","participants":[{"id":"1baa2f3e-12b4-40a8-b38d-f2f8e7736a4b","connectedTime":"2020-01-15T14:17:56.740Z","endTime":"2020-01-15T14:20:38.384Z","name":"xxxxxxxxxx","queueId":"b8749577-2cf8-4d17-9df2-cdc2cfe082fd","purpose":"customer","address":"tel:+xxxxxxxx","wrapupRequired":false,"wrapupExpected":false,"attributes":{"RemoteName":"Skill1","scriptId":"ae209a98-9b71-459e-bbdb-2eca79c26012","Skill":"Skill1","Screen Pop URL":"https://allscripts.service-now.com/navpage.do","ScreenPopName":"EIS-MS Script","Skill1":"LAOC"},"calls":[{"id":"1286e33b-3b3b-4108-86d9-8394d4c28b7d","state":"terminated","recording":false,"recordingState":"none","muted":false,"confined":false,"held":false,"disconnectType":"peer","direction":"inbound","self":{"name":"xxxxxxxx","nameRaw":"xxxxxxx","addressNormalized":"tel:+xxxxxxxxxxx","addressRaw":"sip:xxxxxxx@xxxxxxxxxxx","addressDisplayable":"unavailable","additionalProperties":{}},"other":{"name":"Geel, Belgium","nameRaw":"","addressNormalized":"tel:+xxxxx","addressRaw":"sip:+xxxx@1xxxxxxxxxxx","addressDisplayable":"unavailable","additionalProperties":{}},

    thanks! Owen


    Junji_Sawada | 2020-01-15 20:14:47 UTC | #4

    Hi Owen,

    If you are seeing the attributes there in the JS console and specifying those attribute names in the Framework.config.customInteractionAttributes array, you should see those attributes in interaction.attributes property when you receive an interaction in Framework.js file such as when your Framework.screenPop method is called by the client or when Interaction event is triggered after you subscribe to Interaction event via PureCloud.subscribe API.

    If you are seeing your attributes in Framework.js but not in the parent frame, you may want to investigate whether a message is properly sent from the client frame to the parent frame.

    Junji


    osands | 2020-01-15 20:29:13 UTC | #5

    I'm farily certian the framework.js is getting the same data thats being passed to the parent. here are my subscriptions that are set in it. Does it look right?

    window.PureCloud.subscribe([ { type: 'Interaction', callback: function (category, interaction) { window.parent.postMessage(JSON.stringify({type:"interactionSubscription", data:{category:category, interaction:interaction}}) , ""); } }, { type: 'UserAction', callback: function (category, data) { window.parent.postMessage(JSON.stringify({type:"userActionSubscription", data:{category:category, data:data}}) , ""); } }, { type: 'Notification', callback: function (category, data) { window.parent.postMessage(JSON.stringify({type:"notificationSubscription", data:{category:category, data:data}}) , "*"); } } ]);


    Junji_Sawada | 2020-01-15 20:48:19 UTC | #6

    Owen,

    Is it possible that passing an empty string as a second argument to the window.parent.postMessage is causing an issue?

    Junji


    osands | 2020-01-16 14:12:04 UTC | #7

    seems as though when I copied and pasted the code it didn't translate over. Its actually "*" for each subscription. Its the same code that was in the example :

    https://github.com/MyPureCloud/purecloud-embeddable-framework-example/blob/master/src/framework.js


    Junji_Sawada | 2020-01-16 14:52:21 UTC | #8

    Do you specify your attributes (e.g., "Skill1", "ScreenPopName", "Screen Pop URL", "Skill", "RemoteName", etc.) in Framework.config.customInteractionAttributes? When you put a breakpoint in the callback function for the Interaction event before it calls window.parent.postMessage, does the interaction object has your attributes?


    osands | 2020-01-16 15:27:01 UTC | #9

    Ok we figured it out. In the framework file that I took from the example from was from the CRM one that had dynamic setup of the customattributes code block that was overwriting my setting. I commented this out and now it works:

    /* customInteractionAttributes: (() => { console.log("n custom attribures method"); let customAttributes = new URLSearchParams(window.location.search).get('customAttributes'); console.log("customAttributes == " + customAttributes); if(!customAttributes) return [];

    return customAttributes.split(","); })(), */


    Junji_Sawada | 2020-01-16 16:03:06 UTC | #10

    Glad to hear that it worked!


    osands | 2020-01-16 17:11:09 UTC | #11

    Thanks for the help!


    system | 2020-02-16 17:14:53 UTC | #12

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 6872