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

Answered

11 Comments

  • Lou
    Community Moderator
    The Product Manager Whisperer - 2022

    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
  • Jacob the Moderator
    Community 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
  • Alex C

    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
  • Lou
    Community Moderator
    The Product Manager Whisperer - 2022

    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
  • Lou
    Community Moderator
    The Product Manager Whisperer - 2022

    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
  • Alex C

    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
  • Lou
    Community Moderator
    The Product Manager Whisperer - 2022

    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
  • Alex C

    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
  • Jacob the Moderator
    Community 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
  • Tom Walker

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

    0
  • CJ Johnson

    Could you include the code example as text?

    0

Please sign in to leave a comment.

Powered by Zendesk