Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  WebAPI data action

    Posted 06-05-2025 18:42

    Stav | 2021-03-01 12:01:36 UTC | #1

    Using a WebAPI data action in the request body template I have the following but cant get it to work. (converting from E.164 to a local number.

    { "thisDN":"$esc.jsonString ToPhoneNumber(${Call.CalledAddress}).subscriberNumber" }


    Jerome.Saint-Marc | 2021-03-01 15:07:50 UTC | #2

    Hello,

    You cannot use an Architect function (ToPhoneNumber) or an Architect built-in variable (Call.CalledAddress) inside the definition of your Web Services Data Action.

    Let's assume you have defined an input property of type string in your Data Action (Input Contract), named "dialedNumber".

    Your requestTemplate attribute (of your Request configuration) could contain the following: "requestTemplate": "{\"thisDN\":\"${input.dialedNumber}\"}" I don't think it is necessary to escape this parameter as it should only contains digits.

    As a note, the requestTemplate attribute, of your Request configuration (Web Services Data Action), corresponds to what appears as Request Body Template - when you display the Request configuration as JSON. If you want to cut and paste what I've written above, display the Request configuration as JSON (as it adds/escape specific characters between Simple and JSON).

    Then, from your Architect flow, when you Call your Data Action, in the input parameter corresponding to the "dialedNumber" input property, set the following expression: ToPhoneNumber(Call.CalledAddress).subscriberNumber

    Note: no curly brackets

    Regards,


    Stav | 2021-03-04 11:15:51 UTC | #3

    Hello, Jerome.Saint-Marc

    Thank you very much, I have tested what you suggested and its working as expected.

    I spent a day trying to work out why my original setup wasn't working so you have saved me a lot of pain.

    Will document it for other people using WebAPI.


    Stav | 2021-03-04 11:17:42 UTC | #4

    I forgot to mention, I did modify the expression to the following for 10 digit numbering in Australia ("0"+ToPhoneNumber(Call.CalledAddress).subscriberNumber)

    Thanks again.


    Jerome.Saint-Marc | 2021-03-04 11:41:54 UTC | #5

    Yes - you're right. In case you have not seen this page yet on the Resource Center, it gives some more info on the phone number properties: https://help.mypurecloud.com/articles/about-the-phone-number-data-type/

    Regards,


    system | 2021-04-04 11:41:58 UTC | #6

    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: 10121