Webhook request body from zendesk doesn't escape quote (") characters for title | Community
Skip to main content

Webhook request body from zendesk doesn't escape quote (") characters for title

  • January 25, 2024
  • 4 replies
  • 0 views

Olivier15

I would like to report a bug/

I have integration with third party system and established webhooks with this system.

When I update ticket in zendesk the request is sent, but It doesn't escape quote characters properly and this results in sending invalid json that cannot be parsed in third party system.

For example when I update ticket of name Ticket "23" test 

I receive in body such invalid json for event data {"title": Ticket "23"", ..other properties}
And I should receive {"title": Ticket \"23\"", ..other properties} which could be parsed.

Will you fix this issue?

4 replies

Tipene
  • January 29, 2024

Hi Olivier,

Can you send through an example of the JSON body you're sending with your webhook? I've just tested on my end and it appears to be working as expected:


Olivier15
  • Author
  • January 30, 2024

Hi

I think the problem starts is when I declare trigger for my webhook. Here is the body

{"title":"WebHook Trigger","conditions":{"all":[],"any":[{"field":"update_type","operator":"is","value":"Create"},{"field":"update_type","operator":"is","value":"Change"}]},"actions":[{"field":"notification_target","value":["some value",{"title":"{{ticket.title}}","id":"{{ticket.id}}","status":"{{ticket.status}}","assignee":"{{ticket.assignee.email}}","requester":"{{ticket.requester.email}}","organization_id":"{{ticket.organization.id}}"}]}]}

as you can see i want to receive array of values to be sent to my application. But when format is like this quotes inside ticket.title value is not escaped.
I tried also something like this but it is not working

{"title":"WebHook Trigger","conditions":{"all":[],"any":[{"field":"update_type","operator":"is","value":"Create"},{"field":"update_type","operator":"is","value":"Change"}]},"actions":[{"field":"notification_target","value":["somevalue","{\"title\":\"{{ticket.title}}\",\"id\":{{ticket.id}},\"status\":\"{{ticket.status}}\",\"assignee\":\"{{ticket.assignee.email}}\",\"requester\":\"{{ticket.requester.email}}\",\"organization_id\":\"{{ticket.organization.id}}\"}"]}]}

Could you help me?


Tipene
  • January 30, 2024
Hi Olivier, 
 
I've tried again with the exact payload you've provided and I'm still not able to reproduce the issue. Can you send me the invocation ID of the last few webhook request so I can search our logs for more details. You can read more about how to find the invocation ID here.

Rafael20
  • January 31, 2024

@olivier15 are you passing the following request header?

Content-Type: application/json

Also, have you tried using the escape filter on the placeholders? Such as:

{
"title": "{{ ticket.title | escape }}",
"id": {{ ticket.id }},
"status": "{{ ticket.status | escape }}"
}