Webhook error parse a Jason

david_levy
Contributor
May 8, 2024

I created Webhook that receives json from Twilio, very simple rule just to log the webhook data.

the rule failed with :

"

There was an error when trying to parse the webhook body to JSON (could be due to un-escaped control characters like newlines):
Unrecognized token 'ToCountry': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (ByteArrayInputStream); line: 1, column: 11]"
when I use webhook tester (e.g. https://webhook-test.com/) the data arrived with no issue

 ToCountry=US&ToState=KY&SmsMessageSid=SM70b7ec3fad10bce8acb1b3a4f7802af8&NumMedia=0&ToCity=&FromZip=&SmsSid=SM70b7ec3fad10bce8acb1b3a4f7802af8&FromState=&SmsStatus=received&FromCity=&Body=Thanks&FromCountry=IL&To=%2B18591111784&MessagingServiceSid=MG030b350fdea6061691db81bcc2794289&ToZip=&NumSegments=1&MessageSid=SM70b7ec3fad10bce8acb1b3a4f7802af8&AccountSid=ACa678ed3da20f75aa78b1b568cf2e425b&From=%2B988887292231&ApiVersion=2010-04-01

 

any other suggestions?

1 answer

0 votes
Max McFarland
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2025

You need to encode your data. See the bottom of this documentation. Hopefully you have an option to do this in Twilio.

"In both scenarios, notice the use of {{object.Name.urlEncode}} for encoding the blank space and special characters in the url. This will heavily depend on what the receiving service expects the data to be formatted as. For example, .asJsonString may be more appropriate in the latter example. You can read more about the JSON Functions here: Jira Smart Values - JSON Functions."

How to send a webhook from an automation rule using Assets object data | Jira | Atlassian Documentation

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events