Recent searches


No recent searches

Get link url inside ticket generated by an html email



Posted Mar 07, 2024

I have a trigger that notifies a web hook defined as this:

 

But when I send an html email like this:

<h1>This is a test message</h1>
<p><strong>Test 1</strong></p>
<table cellspacing="0" cellpadding="0" style="">
    <tbody>
        <tr>
              <td align="left" width="auto" height="30px" style="border-collapse: collapse; background-color: #2174c2">
                <a href="https://example.com/sdfsdzvxbvcgbvbvb" rel="noreferrer" target="_blank">
                      <span style="color: #ffffff; white-space: nowrap; display: inline-block; padding: 0 12px;">View #652834 ›</span>
                </a>
              </td>
        </tr>
      </tbody>
</table>

I'm not able to get the link (https://example.com/sdfsdzvxbvcgbvbvb) in the notified web hook. As example link doesn't appear in the posted json.

Is there a way to get the raw html posted to the web hook?

Please note that I've also tried, the following, but results are the same (The url inside the href attribute of the a tag doesn't get rendered anywhere)

{{ticket.latest_comment_html}}
{{ticket.latest_public_comment_html}}
{{ticket.latest_comment_formatted}}
{{ticket.latest_public_comment_formatted}}
{{ticket.latest_comment_rich}}
{{ticket.latest_public_comment_rich}}

 

For reference This is the json that it's being generated and posted by Zendesk to the webhook:

{
    "status": "Pending",
    "description": "----------------------------------------------\n\nREDACTED, Mar 7, 2024, 11:46 AM\n\n# This is a test message\n\n**Test 1**\n\nView #652834 ›",
    "comments": [
        "# This is a test message\n\n**Test 1**\n\nView #652834 ›",
        "----------------------------------------------\n\nREDACTED, Mar 7, 2024, 11:46 AM\n\n# This is a test message\n\n**Test 1**\n\nView #652834 ›",
        "",
        "# This is a test message\n\n**Test 1**\n\nView #652834 ›"
    ]
}

 

 


1

5

5 comments

I'm seeing the same behavior. And the ability to send the raw HTML to a webhook as well. Perhaps this is a bug in the placeholders?

0


I stumbled on the following in the placeholder reference:

> Although placeholders can be in HTML format, when a placeholder is sent to a URL target or webhook, unformatted text is used to render the placeholder, not HTML. Also, placeholders won't work within code blocks. 

So, not a bug… but not intuitive either… if a placeholder is documented to return a particular format, then I would expect it to always do such. Not behave differently dependent of the context that it's used. Quite disappointing.

0


image avatar

Oscar Mejias

Zendesk Customer Care

Thanks for the comment. Crunchy API. 
 
That is correct - when placeholders are sent to an external webhook, the unformatted text is used to render the placeholder which means that it's expected to not see the HREF tag.
 
As an alternative, you may consider rendering the ticket comments from your external service using the Ticket Comments API and collecting the HTML body from the results.
 
Thanks/1 

0


Sure, but I think the concern is that a placeholder that has the `*_html`suffix would always return/render the HTML (properly escaped, etc). Such that there is no inconsistency in behavior of the placeholder across different usages.

For instance, why would `latest_public_comment_html` render as HTML in an email or other medium, but not in a webhook? If the API can return HTML as strings in the JSON response, why can't a webhook do the same? Like I said, it's just not intuitive given the naming of the placeholder.

I accept that this is the nature of how Zendesk has chosen to implement this behavior. But these kinds of inconsistencies is quite frustrating to work with as developers and engineers.

0


image avatar

Oscar Mejias

Zendesk Customer Care

Thanks, Crunchy API!
 
We appreciate the feedback. Our Product Managers will certainly consider this for review - in the meantime, I hope the suggested workaround helps collect HTML-related ticket information via webhook. 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post