Variable method article.body_as_text not available in webhooks cutsom payload

Hi everyone, I’m here to report what I believe is a bug. This behaviour is consistent when trying to send emails through triggers but not when using the same methods to setup a custom webhook payload.

I might also do a separate report to notify that the “article” variable is not available when trying to set a ticket field through article creation trigger. But from what I read, this might be either on purpose or an expected technical limitation.

Infos:

  • Used Zammad version: 7.0.1
  • Used Zammad installation type: (source, package, docker-compose, …) package
  • Operating system: Debian
  • Browser + version: Edge 147.0.3912.72

Expected behavior:

  • From a webhook triggered by an article creation Trigger, I want to be able to use the article.body_as_html or article.body_as_text variables inside the custom payload.

payload:

{
  "text": "#{article.body_as_text}"
}

exemple result:

{
  "text": "This is my amazing article body"
}

Actual behavior:

  • Actual result
{
  "text": "#{article.body_as_text / no such method}"
}

Note: using article.body does return something:

{
  "text": "<div>This is my <b>amazing</b> article body</div>"
}

Steps to reproduce the behavior:

  • Setup a trigger to fire a webhook from an article creation (I specifically used article type email)
  • Setup a webhook to anywhere with a custom payload containing “#{article.body_as_text}”
  • Create an article in a ticket (or send an email in my case)
  • Check webhook logs (/#manage/webhook) to see the json created.

Please check the “Custom” section inside Adding Webhooks — Zammad Admin Documentation documentation

There was also some kind of workaround described in this community some weeks ago, about the article situation.

Thanks ! I searched around and dug a bit more.
There are a few workarounds indeed that probably deserve to be clearly listed as workarounds somewhere. Maybe a “Frequent use cases” somewhere in the doc (or some other name to avoid the unfortunate acronym) ?

To anyone reaching this post in look of an answer, here is what I used:
"text": "#{notification.body}"

Gathered from this page:
Basic Notification — Zammad Admin Documentation documentation
Its seems strange to get notifications variable from an article creation trigger, but hey, it’s not stupid if it works.

Have a nice day !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.