Azure Logic Apps and Twilio AddOn Data

Greetings All,

I have put together a basic logic app that listens for the webhook that Twilio sends out when an SMS messages is received on a given phone number and then formats that into an email to send to specific people. I recently decided to play with the Twilio AddOns for CNAM and Carrier info. The issue I have run into is that unlike all the other data in the webhook, it is all crammed into one single variable. I have an example of the data sent from Twilio below with important data modified to obscure account details.

Initially I was pulling out the To, From, and Body values and assigning them into variables by way of the triggerFormDataValue function (example: @{triggerFormDataValue(‘Body’)) but with all the addon data crammed into a single addon value, how do I take that and break it apart. Ideally I would want to extract caller_name, caller_type from the first block and name and type from the second within the AddOn value.

I am really new at this and would appreciate any assistance anyone can provide.

[ { "key": "ToCountry", "value": "US" }, { "key": "ToState", "value": "FL" }, { "key": "SmsMessageSid", "value": "SM741c292a874f5e34874504aacdffdb725" }, { "key": "NumMedia", "value": "0" }, { "key": "ToCity", "value": "COCOA" }, { "key": "FromZip", "value": "55555" }, { "key": "SmsSid", "value": "SM741c285a80f5e34874504aacdff84217" }, { "key": "FromState", "value": "FL" }, { "key": "SmsStatus", "value": "received" }, { "key": "FromCity", "value": "ORLANDO" }, { "key": "Body", "value": "Test 2" }, { "key": "FromCountry", "value": "US" }, { "key": "To", "value": "+13210000000" }, { "key": "ToZip", "value": "55555" }, { "key": "AddOns", "value": "{"status":"successful","message":null,"code":null,"results":{"twilio_caller_name":{"request_sid":"XR96aa530e147964c682ca86157748547","status":"successful","message":null,"code":null,"result":{"caller_name":{"caller_name":"JOHN DOE","caller_type":"CONSUMER","error_code":null},"phone_number":"+13210000000"}},"twilio_carrier_info":{"request_sid":"XR74bc5226e6de016301c44c2c704588462","status":"successful","message":null,"code":null,"result":{"phone_number":"+13210000000","carrier":{"mobile_country_code":"310","mobile_network_code":"012","name":"Verizon Wireless","type":"mobile","error_code":null}}}}}" }, { "key": "NumSegments", "value": "1" }, { "key": "MessageSid", "value": "SM741c292a80f5e34139504aacdf584754" }, { "key": "AccountSid", "value": "ACd1902edfd8555214376fa4bcbbd85366" }, { "key": "From", "value": "+13210000000" }, { "key": "ApiVersion", "value": "2010-04-01" } ] 

submitted by /u/TechTraveler
[link] [comments]

Leave a Reply