Solved

Web Request Node in Automator fails when using {{ticket.description}} placeholder.

  • 29 December 2021
  • 5 replies
  • 453 views

Userlevel 2
Badge +4

Whenever I use the {{ticket.description}} placeholder in a Web Request node the node fails. The execution logs report the following:
 


This only occurs if I am using the {{ticket.description}} placeholder. Has anyone else had an issue with this?

Example JSON that fails.


Additionally, when using {{ticket.description}} placeholder in the Powershell Orchestrator App Node, the value of {{ticket.description}} does not exist. The command will return success, but I cannot get a simple print statement to output what should be the value of the text. 

Replacing the placeholder with another placeholder results in success. It is only the {{ticket.description}} that is failing so far.

icon

Best answer by sean.groomes 3 January 2022, 19:35

View original

5 replies

Userlevel 2
Badge +4



The Body field for the Web Request node does not like the HTML tags that are stored in the value of the description field of the placeholder object resulting in the failure of the webhook to be sent.

You can view the information that is to be replaced by the placeholder text by calling the various GET endpoints that correspond with the object being referenced. In this case you can use the View Ticket Endpoint to see the value of description is returned as HTML.

While I don’t have exact confirmation, it’s fairly obvious the JSON parser is croaking when the HTML tags passed by the placeholder are parsed.

There is another field call “description_text”, that contains the plain text value of the description.

You can manually specify {{ticket.description_text}} to access the plain text value to get around the problem.

This is currently undocumented, and not selectable from the Insert Placeholder menu.

Hope this helps someone else sometime.

Userlevel 2
Badge +4

URL encode the value of the description. https://shopify.github.io/liquid/filters/url_encode/

Example: {{ticket.description | url_encode}}

 

Userlevel 3
Badge +4

If you are using V1 api, you can use description_html

 


For example to create a ticket you can use the following 

curl -v -u <your api key>:X -H "Content-Type: application/json" -d '{ "helpdesk_ticket": { "description_html": "https://reqbin.com/curl", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2 }}' -X POST https://domain.freshservice.com/helpdesk/tickets.json

Userlevel 2
Badge +4

V1 is deprecated, it is not reliable to use that anymore with its impending shutdown. 

The only real way around this is to use description_text and if passing the content in a URL parameter to use the liquid filter to URL encode any potentially complex text, like the subject and description, or any custom fields.
 

If you are using V1 api, you can use description_html

 


For example to create a ticket you can use the following 

curl -v -u <your api key>:X -H "Content-Type: application/json" -d '{ "helpdesk_ticket": { "description_html": "https://reqbin.com/curl", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2 }}' -X POST https://domain.freshservice.com/helpdesk/tickets.json

 

Userlevel 7
Badge +11

Hello, 

{{ticket.description | url_encode }} works or {{ticket.description | sanitize_html}} 

Example #7 on this page you have more info 
https://support.freshservice.com/en/support/solutions/articles/50000003382-powerful-placeholders-with-liquid-filters

Reply