Skip to main content
Solved

Automator Web Request Body Empty on POST

  • November 29, 2022
  • 4 replies
  • 517 views

jk1990
Apprentice
Forum|alt.badge.img

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

Best answer by MichaelS24

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

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+5
  • Skilled Expert
  • 17 replies
  • November 29, 2022

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!

 

 


jk1990
Apprentice
Forum|alt.badge.img
  • Author
  • Apprentice
  • 2 replies
  • November 29, 2022
MichaelS24 wrote:

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


Forum|alt.badge.img+5
  • Skilled Expert
  • 17 replies
  • Answer
  • November 29, 2022

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


jk1990
Apprentice
Forum|alt.badge.img
  • Author
  • Apprentice
  • 2 replies
  • November 29, 2022

Reintroducing double quotes as well as html_sanitize has sorted it! 

Thanks for you help with this one


Reply