Solved

Automator Web Request Body Empty on POST

  • 29 November 2022
  • 4 replies
  • 291 views

Badge

Hi all -

 

I am trying to build a simple flow which sends an HTTP Request to another service when a new ticket is created. The code and connectivity are working fine in Postman but the issue I am getting in FreshService is that the POST Body is empty in the Automation Logs which in turn is throwing an error. 

 

There is a similar thread here with no resolution:

Web Request Node Invalid JSON | Freshworks Community

 

To confirm, when testing in Postman with the EXACT same configuration, the POST is successful

 

Payload Body in FreshService

I assume there’s something funky going on with the payload placeholders - is the description field breaking formatting perhaps? If so, why isn’t this being handled by the placeholder functionality to escape characters? For reference, I have also tried adding quotes around the values with no change to output. 

{
"subject": {{ticket.subject}},
"description": {{ticket.description | sanitize_html}},
"priority": {{ticket.priority}},
"urgency": {{ticket.urgency}},
"id": {{ticket.id}},
"requester": {{ticket.from_email}}
}

 

Error Log:

 

Any help would be greatly appreciated

icon

Best answer by MichaelS24 29 November 2022, 10:16

View original

4 replies

Userlevel 3
Badge +4

Hey jk1990,

Try add the following filter in the description placeholder {{ticket.description | sanitize_html}}.

Look at the last example in this post for more information: Powerful Placeholders with Liquid Filters : Freshservice

I hope this will sort it out as I kept running into the same problem with my web-requests for a long time.

Let us know how you go!

 

 

Badge

Hey jk1990,

Try add the following filter in the description placeholder {{ticket.description | sanitize_html}}.

Look at the last example in this post for more information: Powerful Placeholders with Liquid Filters : Freshservice

I hope this will sort it out as I kept running into the same problem with my web-requests for a long time.

Let us know how you go!

 

 

 

Thanks for the tip! Funnily enough I tried this just after posting but no change to the issue. The log still reports an invalid JSON payload

Userlevel 3
Badge +4

I am questioning the requester placeholder now. Looking at the documentation for POST. Should be either:

“requester_id”: 12345678900 

OR

“email”: “first.last@domain.com

I would also enclose the text fields in double-quotes and keep the sanitize_html filter.

{
"subject": "{{ticket.subject}}",
"description": "{{ticket.description | sanitize_html}}",
"priority": {{ticket.priority}},
"urgency": {{ticket.urgency}},
"id": {{ticket.id}},
"email": "{{ticket.from_email}}"
}

or

{
"subject": "{{ticket.subject}}",
"description": "{{ticket.description | sanitize_html}}",
"priority": {{ticket.priority}},
"urgency": {{ticket.urgency}},
"id": {{ticket.id}},
"requester_id": {{id}}
}

Would test using example input params in the web request node to get a bit more information and using a process of elimination.

 



Failing that - might be worth hitting up fresh support

Badge

Reintroducing double quotes as well as html_sanitize has sorted it! 

Thanks for you help with this one

Reply