Resources »

Workflows »

Group (Opt-In) Watchers

Introduction

This workflow automatically add workers who are watching a group as watchers for tickets moved to (or created in) that group.

Installation

Navigate to Search » Workflows » (+) » Empty.

Paste the following KATA into the large text box:

workflow:
  name: wgm.email.group_optin_watchers
  version: 2025-10-08T22:13:31Z
  description: Automatically add group watchers as ticket watchers for new/moved tickets.
  website: https://cerb.ai/workflows/wgm.email.group_optin_watchers/
  requirements:
    cerb_version: >=11.0 <11.2
    cerb_plugins: cerberusweb.core,
records:
  automation_event_listener/listenerMailMoved:
    fields:
      name: Group (Opt-In) Watchers
      event_name: mail.moved
      priority@int: 100
      is_disabled: 0
      event_kata@raw:
        automation/addGroupWatchers:
          uri: cerb:automation:wgm.email.group_optin_watchers.mailMoved
          disabled@bool: no
  automation/automationMailMoved:
    fields:
      name: wgm.email.group_optin_watchers.mailMoved
      extension_id: cerb.trigger.mail.moved
      description: Add group watchers as ticket watchers for new/moved tickets.
      script@raw:
        start:
          # Build a list of Group Watchers to add to the Ticket
          set:
            watcher_links@list:
              {{
                ticket_group_links["cerberusweb.contexts.worker"]
                |values
                |map((v,k) => 'worker:' ~ v)
                |join('\n')
              }}
              
          # Only update if we have group members
          outcome/hasWatchers:
            if@bool: {{watcher_links is not empty}}
            then:
              record.update:
                inputs:
                  record_type: ticket
                  record_id: {{ticket_id}}
                  fields:
                    links@key: watcher_links
      policy_kata@raw:
        commands:
          record.update:
            deny/type@bool: {{inputs.record_type is not record type ('ticket')}}
            allow@bool: yes

Click the Continue button three times.

You should see output like the following:

Click the Save Changes button.

Usage

When a new ticket is created from incoming email or when an existing ticket is moved, all workers who are watching the ticket's assigned group will automatically be added as watchers to that ticket.

To watch a group, open your worker card

and click Links » Group. Select the groups you want to watch and click the Save Changes button.

Testing with imported message

You can test this workflow by importing a sample email message. Navigate to Setup » Mail » Incoming » Import Message and paste the following test message:

From: customer@cerb.example
To: support@cerb.example
Subject: Test ticket for group watchers
Message-ID: <test-group-optin-watchers-a1b2c3@cerb.example>

This is a test message to verify that group watchers are added as watchers to new tickets.

Please move this ticket to a group with multiple members to see the workflow in action.

After importing, check the created ticket's watchers to verify that all group watchers have been automatically added as ticket watchers.