Ticket Notification Subscriptions in Webhook Object/Endpoint

Hello,

I’m trying to get information on users who have notification subscriptions for a case/ticket. Preferably it would be nice to see a list of users subscribed to notifications in the webhook object.

Is this info in the webhook payload and I’m just missing it? Or perhaps there’s an API endpoint where I can get this information?

Here is the notification subscription I’m referring to…

Hoping the list of subscribers shows up in the webhook payload…

https://admin-docs.zammad.org/en/latest/manage/webhook/payload.html

OK - answering my own question here.

After some inspection of the browser network traffic, I discovered these are called “mentions” and they don’t show up in the Webhook payload.

When receiving the Webhook payload, you then have to make an API call to /api/v1/tickets/{ticket_id}?all=true

The “all=true” get parameter is important.

In the response, at assets.Mention - loop thru the array of objects and there is a user_id

Then you can go to assets.User.{user_id} and get the object of each user subscribed to ticket notifications.

As far as I can tell this is only way to get the list of users subscribed to ticket notifications.

Any better ideas out there?

JFI the webhook payload should also include this. The documentation version shows only populated fields and I may have gotten the payload from a ticket without mentions attached. I can’t remember. If you test fire one yourself with the things you need, you should see how and if it’s there.

hi @MrGeneration

Thanks for the response.

Here is an example payload we got in a Zammad webhook. Names have been changed to protect the innocent…I don’t see anything about “mentions” in this payload. Am I missing something?

{
        "ticket": {
            "article_count": 10,
            "article_ids": [
                19814,
                19878,
                20047,
                20048,
                20049,
                20507,
                20508,
                20559,
                20779,
                20780,
                20781,
                20782,
                20791,
                20792,
                20793,
                20797,
                20798,
                20799,
                20808,
                20809,
                20813,
                20876,
                20939,
                20940,
                20941,
                21283,
                21284
            ],
            "close_at": "2023-03-22T19:38:11.478Z",
            "close_diff_in_min": null,
            "close_escalation_at": null,
            "close_in_min": null,
            "create_article_sender": "Customer",
            "create_article_sender_id": 2,
            "create_article_type": "email",
            "create_article_type_id": 1,
            "created_at": "2023-03-21T21:43:25.161Z",
            "created_by": {
                "active": true,
                "address": null,
                "city": "",
                "country": "",
                "created_at": "2022-12-21T22:54:02.396Z",
                "created_by": "karen@example.com",
                "created_by_id": 728,
                "department": null,
                "email": "karen@example.com",
                "fax": "",
                "firstname": "Karen",
                "id": 728,
                "image": null,
                "image_source": null,
                "lastname": "Peters",
                "login": "karen@example.com",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [
                    3
                ],
                "roles": [
                    "Customer"
                ],
                "source": null,
                "street": "",
                "updated_at": "2023-03-28T12:59:31.262Z",
                "updated_by": "rick@example.com",
                "updated_by_id": 9,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "created_by_id": 728,
            "customer": {
                "active": true,
                "address": null,
                "city": "",
                "country": "",
                "created_at": "2022-12-21T22:54:02.396Z",
                "created_by": "karen@example.com",
                "created_by_id": 728,
                "department": null,
                "email": "karen@example.com",
                "fax": "",
                "firstname": "Karen",
                "id": 728,
                "image": null,
                "image_source": null,
                "lastname": "Peters",
                "login": "karen@example.com",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [
                    3
                ],
                "roles": [
                    "Customer"
                ],
                "source": null,
                "street": "",
                "updated_at": "2023-03-28T12:59:31.262Z",
                "updated_by": "rick@example.com",
                "updated_by_id": 9,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "customer_id": 728,
            "escalation_at": null,
            "first_response_at": "2023-03-22T19:38:11.654Z",
            "first_response_diff_in_min": null,
            "first_response_escalation_at": null,
            "first_response_in_min": null,
            "group": {
                "active": true,
                "assignment_timeout": null,
                "created_at": "2022-11-27T13:01:31.415Z",
                "created_by": "andrew@example.com",
                "created_by_id": 4,
                "email_address_id": 1,
                "follow_up_assignment": true,
                "follow_up_possible": "yes",
                "id": 2,
                "name": "Acme Support Team",
                "note": "",
                "reopen_time_in_days": null,
                "shared_drafts": true,
                "signature": "Acme",
                "signature_id": 1,
                "updated_at": "2022-12-30T23:36:36.540Z",
                "updated_by": "andrew@example.com",
                "updated_by_id": 4,
                "user_ids": [
                    9,
                    4,
                    155,
                    231,
                    128,
                    96,
                    253,
                    880,
                    881,
                    882,
                    883,
                    883
                ],
                "users": [
                    "rick@example.com",
                    "andrew@example.com",
                    "christie@example.com",
                    "valeria@example.com",
                    "james@example.com",
                    "zhenya@example.com",
                    "no-reply@example.com",
                    "lina@example.com",
                    "kelly@example.com",
                    "adrianna@example.com",
                    "production@example.com",
                    "production@example.com"
                ]
            },
            "group_id": 2,
            "id": 6319,
            "last_close_at": "2023-03-28T12:59:26.065Z",
            "last_contact_agent_at": "2023-03-28T12:59:26.127Z",
            "last_contact_at": "2023-03-29T16:33:44.644Z",
            "last_contact_customer_at": "2023-03-29T16:33:44.644Z",
            "last_owner_update_at": "2023-03-29T16:33:44.602Z",
            "note": null,
            "number": "346310",
            "organization_id": null,
            "owner": {
                "active": false,
                "address": "",
                "city": "",
                "country": "",
                "created_at": "2022-11-15T15:55:22.337Z",
                "created_by": "-",
                "created_by_id": 1,
                "department": "",
                "email": "",
                "fax": "",
                "firstname": "-",
                "id": 1,
                "image": null,
                "image_source": null,
                "lastname": "",
                "login": "-",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [],
                "roles": [],
                "source": null,
                "street": "",
                "updated_at": "2022-11-15T15:55:22.337Z",
                "updated_by": "-",
                "updated_by_id": 1,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "owner_id": 1,
            "pending_time": null,
            "preferences": {
                "channel_id": 3
            },
            "priority": {
                "active": true,
                "created_at": "2022-11-15T15:55:22.670Z",
                "created_by": "-",
                "created_by_id": 1,
                "default_create": true,
                "id": 2,
                "name": "2 normal",
                "note": null,
                "ui_color": null,
                "ui_icon": null,
                "updated_at": "2022-11-15T15:55:22.670Z",
                "updated_by": "-",
                "updated_by_id": 1
            },
            "priority_id": 2,
            "state": "open",
            "state_id": 2,
            "ticket_time_accounting": [],
            "ticket_time_accounting_ids": [],
            "time_unit": null,
            "title": "FW: po# 422637-02knk\/MS90556C52412PW . appearance defect.",
            "type": "",
            "update_diff_in_min": null,
            "update_escalation_at": null,
            "update_in_min": null,
            "updated_at": "2023-03-29T16:33:45.165Z",
            "updated_by": {
                "active": true,
                "address": null,
                "city": "",
                "country": "",
                "created_at": "2022-12-21T22:54:02.396Z",
                "created_by": "karen@example.com",
                "created_by_id": 728,
                "department": null,
                "email": "karen@example.com",
                "fax": "",
                "firstname": "Karen",
                "id": 728,
                "image": null,
                "image_source": null,
                "lastname": "Peters",
                "login": "karen@example.com",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [
                    3
                ],
                "roles": [
                    "Customer"
                ],
                "source": null,
                "street": "",
                "updated_at": "2023-03-28T12:59:31.262Z",
                "updated_by": "rick@example.com",
                "updated_by_id": 9,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "updated_by_id": 728,
            "organization": []
        },
        "article": {
            "attachments": [
                {
                    "id": 22760,
                    "store_file_id": 16911,
                    "filename": "message.html",
                    "size": "20701",
                    "preferences": {
                        "content-alternative": true,
                        "original-format": true,
                        "Mime-Type": "text\/html",
                        "Charset": "UTF-8"
                    },
                    "url": "https:\/\/www.support.com\/api\/v1\/ticket_attachment\/6319\/21283\/22760"
                }
            ],
            "body": "redacted",
            "cc": null,
            "content_type": "text\/html",
            "created_at": "2023-03-29T16:33:44.644Z",
            "created_by": {
                "active": true,
                "address": null,
                "city": "",
                "country": "",
                "created_at": "2022-12-21T22:54:02.396Z",
                "created_by": "karen@example.com",
                "created_by_id": 728,
                "department": null,
                "email": "karen@example.com",
                "fax": "",
                "firstname": "Karen",
                "id": 728,
                "image": null,
                "image_source": null,
                "lastname": "Peters",
                "login": "karen@example.com",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [
                    3
                ],
                "roles": [
                    "Customer"
                ],
                "source": null,
                "street": "",
                "updated_at": "2023-03-28T12:59:31.262Z",
                "updated_by": "rick@example.com",
                "updated_by_id": 9,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "created_by_id": 728,
            "from": "Karen <karen@example.com>",
            "id": 21283,
            "in_reply_to": null,
            "internal": false,
            "message_id": "<e90ef96113c64709b7a36dc2bb54b745@LADV-MTAEXS01.example.com>",
            "message_id_md5": "a43062e66afab6ae1da6e5f8b9783c50",
            "origin_by_id": null,
            "preferences": {
                "send-auto-response": true,
                "is-auto-response": false
            },
            "references": null,
            "reply_to": null,
            "sender": "Customer",
            "sender_id": 2,
            "subject": "RE: po# 422637-02knk\/MS90556C52412PW . appearance defect.",
            "ticket_id": 6319,
            "to": "Acme Sales Support <sales@example.com>",
            "type": "email",
            "type_id": 1,
            "updated_at": "2023-03-29T16:33:44.644Z",
            "updated_by": {
                "active": true,
                "address": null,
                "city": "",
                "country": "",
                "created_at": "2022-12-21T22:54:02.396Z",
                "created_by": "karen@example.com",
                "created_by_id": 728,
                "department": null,
                "email": "karen@example.com",
                "fax": "",
                "firstname": "Karen",
                "id": 728,
                "image": null,
                "image_source": null,
                "lastname": "Peters",
                "login": "karen@example.com",
                "mobile": "",
                "note": "",
                "organization_id": null,
                "organization_ids": [],
                "organizations": [],
                "out_of_office": false,
                "out_of_office_end_at": null,
                "out_of_office_replacement_id": null,
                "out_of_office_start_at": null,
                "overview_sorting_ids": [],
                "overview_sortings": [],
                "phone": "",
                "role_ids": [
                    3
                ],
                "roles": [
                    "Customer"
                ],
                "source": null,
                "street": "",
                "updated_at": "2023-03-28T12:59:31.262Z",
                "updated_by": "rick@example.com",
                "updated_by_id": 9,
                "verified": false,
                "vip": false,
                "web": "",
                "zip": ""
            },
            "updated_by_id": 728,
            "accounted_time": 0
        }
    }

You’re right.

The only place you can actually “see” the mention is in the body of the article (if applicable)

...
"article": {
    "attachments": [],
    "body": " xxx <a href=\"https://xxx.domain.tld/#user/profile/5\" data-mention-user-id=\"5\" rel=\"nofollow noreferrer noopener\" title=\"https://xxx.domain.tld/#user/profile/5\">Emma Taylor</a>"

The reason seems to be that Zammad doesn’t store mentions directly on the ticket:

#<Ticket:0x00007f4f2d33c1c8
 id: 15,
 group_id: 2,
 priority_id: 2,
 state_id: 3,
 organization_id: 1,
 number: "32015",
 title: "xxx",
 owner_id: 3,
 customer_id: 2,
 note: nil,
 first_response_at: Wed, 05 Apr 2023 15:51:28.931000000 UTC +00:00,
 first_response_escalation_at: nil,
 first_response_in_min: nil,
 first_response_diff_in_min: nil,
 close_at: nil,
 close_escalation_at: nil,
 close_in_min: nil,
 close_diff_in_min: nil,
 update_escalation_at: nil,
 update_in_min: nil,
 update_diff_in_min: nil,
 last_close_at: nil,
 last_contact_at: Wed, 05 Apr 2023 15:51:28.931000000 UTC +00:00,
 last_contact_agent_at: Wed, 05 Apr 2023 15:51:28.931000000 UTC +00:00,
 last_contact_customer_at: Tue, 04 Apr 2023 15:53:21.278000000 UTC +00:00,
 last_owner_update_at: Wed, 05 Apr 2023 15:51:28.956000000 UTC +00:00,
 create_article_type_id: 5,
 create_article_sender_id: 2,
 article_count: 5,
 escalation_at: nil,
 pending_time: Fri, 28 Apr 2023 06:00:00.000000000 UTC +00:00,
 type: nil,
 time_unit: nil,
 preferences: {},
 updated_by_id: 3,
 created_by_id: 3,
 created_at: Tue, 04 Apr 2023 15:53:21.233000000 UTC +00:00,
 updated_at: Thu, 13 Apr 2023 16:14:22.725000000 UTC +00:00>

So basically what you’re trying to achieve is not possible.
The only way to get mentions seems to mimik Zammads UI (be aware that this method is not documented and may change in the future and thus potentially is anything but update safe):

/api/v1/tickets/:id with the parameter all=true.
This returns a lot of information.

I’d personally suggest filling a feature request to expand the behavior or having such an information available via Feature requests - Zammad - Community

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