Skip to main content
Question

Line breaks not rendering with webhooks


Hey guys,

I’m trying to post a comment from Zendesk as webhook, which generally works just fine. However, as soon as the message is written with line breaks the webhook field structure gets affected. This makes is impossible to access the fields in actions further down in the Zap.

Any ideas?

 

Webhook without the line break:

Outbound message

email_address: 4149523239385f6d6573736167696e675f3236363435393533332d3939363632303234352d39373333303737373434@test.com

message: Message without a line break

 

Webhook with line break:

Outbound message
[
{
"email_address": "4149523239385f6d6573736167696e675f3236363435393533332d3939363632303234352d39373333303737373434@test.com",
"message": "Hi Peter,
This is a message with a couple of line breaks
Best
Johannes"
}
]

 

This is the body I’m sending from Zendesk:

[
{
    "email_address": "{{ticket.requester.email}}",
    "message": "{{ticket.latest_public_comment}}"
}
]

 

Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Wemakefuture
Forum|alt.badge.img+8
  • Zapier Expert
  • 166 replies
  • July 19, 2021

@Johannes please post me an example here https://hooks.zapier.com/hooks/catch/4905176/b212ejl/


  • Author
  • Beginner
  • 7 replies
  • July 19, 2021

Hey @Wemakefuture,

just sent you two examples. One with and one without line breaks.

 

Thanks

Johannes


Wemakefuture
Forum|alt.badge.img+8
  • Zapier Expert
  • 166 replies
  • July 19, 2021

Thanks I saw the data, it is really nested and unstructured. I will try some. 


Wemakefuture
Forum|alt.badge.img+8
  • Zapier Expert
  • 166 replies
  • July 19, 2021

Python code: 

s = input_data['st']
import urllib.parse
d = urllib.parse.parse_qs(s.replace("%22%5D%0A%7D%0A%5D","").replace("%0A","").replace("%5B%222",""))

output = {'id': d}

From here try to remove everything before “message” with a text formater (I think its the most efficent way) 

The dict (json) is badly designed by zendesk via the query they send over.

Use the formater Text after the code: 


 

 

Now you could replace the [“

With more time one could maybe do it better with code - but as hotfix it should work.