Add/Remove Watchers

You can choose to add or remove watchers on spaces, blogs, or content selected by the CQL when prompted by a Confluence event.

  1. In Note, you can enter a note for your reference. 
    This note shows up on the main Listeners screen.
  2. Select some Event(s) that you'd like to listen for. The Event(s) you select triggers the change to watchers.
    After you select some Event(s), the Select By field appears.

    Crowd events are supported.

  3. For Condition, enter code in the Script tab or upload code in the File tab.
    This code evaluates after one of your selected events is fired, and is used to determine whether or not the listener should execute. 

    If left blank, the condition automatically evaluates to "true."

    Select Show Examples to see provided conditions. Once you select one, you can paste it in the field.

  4. For Select By, select the type of content that you'd like to work with.

    Your choices are:

    • Space

      When you select Space, the user(s) and/or group(s) are added as space watchers not page watchers.

      Additionally, if you select Space and remove user(s) as watchers, they may still watch the pages in the space.

    • Blog

    • CQL

      When you select CQL, the user(s) and group(s) are added as page watchers. 

      Additionally, if you select CQL and add user(s) as watchers to a space, they may still be space watchers.

  5. Based on what you select in the previous step, you see one of the following:

    • Target Space - Enter the space you want to work with if you picked Space or Blog.

    • CQL Query - Enter the query you want to work with if you picked CQL.

      Select Show Examples to see provided CQL queries. If you select one, the field auto-fills with the query.

      The hit counter to the right of the field indicates how many results are returned by the CQL query you entered.

  6. For Apply to Groups, select which group(s) you want to work with.

  7. For Apply to Users, select which user(s) you want to work with.

    You can select both users and groups for each set of watchers you are working with.
  8. For Action, select if you want the group(s) and/or user(s) to Watch or Unwatch.

  9. Select Preview to view results, or select Run to apply the change.

    Users are only listed in the results if they have permission to view the selected content.

    If you add a user who was already watching the content, they are not listed in the results.

    If you try to remove a watcher that was not watching the content, they are not listed in the results.

Example: Add New Marketing Users as Watchers for Marketing Space

In your Confluence instance, you may have groups for different departments in your organization. You may have a space for each department in your organization as well. When a new user joins the team, you may want to have them watch their department's space so they're notified of information that relates to them. Using the Add/Remove Watchers listener, you can automate this. In this example, we will set up a listener that will add any new users added to the Marketing group as watchers of the Marketing space.

Only new users added to the group then become watchers. The groups won't necessarily stay in sync.

  1. For Note, enter a description for your reference, like Add Marketing Watchers
  2. For Event, select GroupMembershipsCreatedEvent.
  3. For Condition, enter the following code: 

    groovy
    event.groupName == "marketing-users"
  4. For Select By, choose Space
  5. For Target Space, select your marketing space.
    For example, Marketing. 
  6. For Apply to Groups, select your marketing group.
    For example, marketing-users
  7. Leave Apply to Users blank. 
  8. Select Watch for the Action
  9. Select Add
On this page