Recent searches


No recent searches

How to format a comment when using Notify active webhook action?

Answered


Posted Sep 08, 2022

I'm hoping someone on the community has successfully done this and can give me some tips!

Objective: Using a trigger, we want to send automated messages to customers that include some text formatting (e.g. line breaks, bullet points, hyperlinked text, bold, italic, etc), and that it is visible as a public comment in the ticket.

What we've tried: We have used the "Email user" trigger action in the past, but this does not send a public comment in the ticket, only an email to the customer. This means the agent can't see it in the ticket (in Events they can see an email notification was sent, but the message itself is not visible in a readable way), and the customer can't see it in the Requests ticket page (https://{help center domain}/requests/{ticket-number}).

Where we're stuck: Using the "Notify active webhook" trigger action, we are able to send a public comment to the ticket, but it must be in JSON format. The blocker is we have not figured out a way to send "formatted" text via JSON and have Zendesk translate it to nicely formatted  text for customers.


1

11

11 comments

image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

Alex C

We use URL targets to add public (or private) comments to tickets.

The URL is https://yourdomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json?ticket[comment][public]=true   (or false for private; you need to set up a separate target for each)

The method is PUT.

The Attribute name is ticket[comment][body]

We then notify that target in the trigger with the comment. It's much simpler than using JSON, and it works great for us. I check regularly for failures and can't remember the last time I saw one (and we use it a lot).

I tried to keep it brief, but if you want more detail, I'd be happy to provide it.

1


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Alex,

Just a quick note here on making HTML conform to JSON standards, I use the below article as a reference whenever I need to do such things - hope it helps you out.

4 Things You Must Do When Putting HTML in JSON - Thorn Technologies

1


Hi Lou! Thank you for that response! I see a light at the end of the tunnel! I tried it but I'm getting an "Error during transmission: HTTP client call failed" when testing, but I'll check with a dev and keep trying. Can I bother you with a screenshot of your URL target configuration (with domain blanked)? Just so I can check I'm not just making one of those classic user errors over here.

0


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

Alex C

Here you go:

Some of the URL is cut off. It's https://yourdomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json?ticket[comment][public]=true

Also, below the screenshot is where the authentication is input. A few things to check:

  • Make sure you have an API token set up in your instance
  • Make sure you're using the https address of your instance
  • Make sure you have authentication set up (login credentials)

 

0


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

Alex C

Also, if you have the API token set up, check it for failures. Might be a clue there. Here's an example:

If I click on this failure, the details open up and tell me what's going on:

The trigger was trying to fire on a closed ticket after it automatically closed. I was able to fix it by adding a condition to the trigger.

0


Lou yesssss!!!! That did it! Your credentials comment made me think of a time username+pw wasn't working, so I had used Username = {email}/token / Password = {API token}. And that fixed the error, and then I used Markdown to format the comment (in case someone stumbles on this question, currently it says links (hyperlinked text) isn't supported yet, but it is!). So this worked! Thank you so much!

0


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

Alex C

That's awesome. I'm glad I could help. Many times when I go into a target or webhook, the credentials disappear for some odd reason, so any time I mess with them, I reenter my credentials just in case.

0


Jacob the Moderator! Not sure how I missed your message. Thank you for including that! I had done some digging in HTML > JSON conversion and came across the whole "escaping" characters. The article you linked was much friendlier, I'll keep it in mind for another use case. For this particular one, I'd recommend Lou's alternative. 

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Alex C 👋

Glad you were able to work it out with Lou!
Ironically, my message was stuck in moderation, so it showed up late to the party.

0


Thank you all for this thread, this just walked me through getting this setup for a similar solution.

0


Could you include the code example as text?

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post