Jira Server: NotificationFilter for Jira Servicedesk

Hi community,

I’m using a custom implementation of the NotificationFilter. The filter needs to be registered in the atlassian-plugin.xml and points to the implementation class:

    <notification-filter key="NotificationFilter" name="Jira Notification Filter"
                         class="com.company.addon.NotificationFilterImplementation" />

The filter has no problems with seeing notifications outside of the Jira Servicedesk context (i.e. notifications when commenting on a regular non Jira SD issue).

However, every notification related to an issue in JSD is not picked up by the filter.
Is there any similar filter just for Jira servicedesk? Consulting the JSD API docs it doesn’t look like it.

Does anybody know if there is fix or workaround for that?

Maybe @iragudo or @acalantog know someone who knows the answer to that.

Thanks for the mention, @tobitheo :slight_smile: I’ll see what I can do.

1 Like

Hi @j.borrmann,

Can you give more information on the kind of notifications you are using from NotificationFilterContext.

Are you filtering ISSUE_EVENT or something else?

Yes, I filter the ISSUE_EVENT, specifically ISSUE_CREATED_ID and ISSUE_COMMENTED_ID.
However, the filter sees every notification as it seems to work independently from my event listener.
I’m using the notificationFilterContext to check, if it is the event I really want to filter and addition to that the issueEventParameters to see, if it is a notification I want to filter. To make that work, I have to republish the event of course, putting an additional parameter to the map.

The filter works well, if the comment or issue isn’t created in a Jira service desk project.
The event listener is triggered in both cases though, regardless of if it is a JSD project or not.

Issues created in Service Desk projects are still Jira issues. Both ISSUE_CREATED_ID and ISSUE_COMMENTED_ID should work for service desk issues. I can see them being fired locally for JSD issues.

Perhaps these issues are getting lost in the second step of filtering with parameters. What are you doing in this second step?

Hi Deeksha,

it’s important to know, that the filter is listening completely independently from my event listener. As another test, I just commented out all my event listener code. The filter is still loaded via the atlassian-plugin.xml and I can see that it is writing into the log file as instructed. But only, as long as I work on a regular Jira issue.

As soon as I work on JSD issue, the filter is just quiet.

I hope that answers your question.

Hi @j.borrmann,

I built a little test plugin to try it out and I can catch both ISSUE_CREATED_ID (1L) and ISSUE_COMMENTED_ID (6L) (public and internal comments) for Service Desk issues. It should work.

Are there any errors or exceptions that you can see?
Are you filtering context.getIssueEvent.eventTypeId to get the specific comment and issue created events?


did you also load the notification filter and did you see notifications flowing through, even for Jira service desk notifications? Again, I have no problems in catching the events for service desk issues. Hence, no errors. I don’t get any others either. When it comes to Jira Services desk related notifications, I don’t even get to the point where I could filter for context.getIssueEvent.eventTypeId.

You need to load the filter via the atlassian plugin xml as described in my first comment here and write a simple implementation of the notification filter for your test plugin to see what I mean. This is the implementation I am using. Basically every notification related to a Jira issue is flowing through here, regardless of any events I am catching. Don’t forget that please. And again, this filter doesn’t see any Jira servicedesk related notifications and I need to know why and what I can do about it.

import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.notification.IssueEventNotificationFilterContext;
import com.atlassian.jira.notification.NotificationFilter;
import com.atlassian.jira.notification.NotificationFilterContext;
import com.atlassian.jira.notification.NotificationRecipient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.Map;

public class NotificationFilterImpl implements NotificationFilter {

    private static final Logger logger = LoggerFactory.getLogger(NotificationFilterImpl.class);

    public boolean removeRecipient(NotificationRecipient notificationRecipient, NotificationFilterContext notificationFilterContext) {
        if (notificationFilterContext instanceof IssueEventNotificationFilterContext) {
            IssueEventNotificationFilterContext context = (IssueEventNotificationFilterContext) notificationFilterContext;

            IssueEvent issueEvent = context.getIssueEvent();
            if (mailShouldBeSuppressed(issueEvent)) {
                logger.debug("Removed recipient {} from notification for Jira issue {}", notificationRecipient.getEmail(), issueEvent.getIssue().getKey());
                return true;
        return false;

    private boolean mailShouldBeSuppressed(IssueEvent issueEvent) {

        Map<String, Object> issueEventParameters = issueEvent.getParams();

        if (issueEventParameters.containsKey("dont-discard-notification")) {
            return false;

        return true;



    public Iterable<NotificationRecipient> addRecipient(NotificationFilterContext notificationFilterContext, Iterable<NotificationRecipient> iterable) {
        return Collections.EMPTY_LIST;



Thanks for the detailed response.

Yes I loaded my plugin to test it. I used your code and replaced the addRecipient code to add a recipient. removeRecipient is called after addRecipient if there are recipients because it is a way of cleaning up after all plugins have added recipients.

    public Iterable<NotificationRecipient> addRecipient(NotificationFilterContext context, Iterable<NotificationRecipient> intendedRecipients) {
        if (context.getReason().equals(JiraNotificationReason.ISSUE_EVENT)) {
            return Lists.newArrayList(new NotificationRecipient("elvis@vegas.com"));
        return Collections.emptyList();

Jira and Service Desk specific notifications are different. Service Desk issues will send both of these but only Jira notifications can be filtered with this SPI. So you can catch Jira notifications on Service Desk issues such as notifications on Issue created but not on Request created through the portal. We currently don’t have notification filtering for Service Desk specific notifications (anything in /jira/servicedesk/admin/{projectKey}/customer-notifications).

Are you attempting to filter Service Desk specific notifications? What do you mean by seeing notifications flowing through? This SPI is to add and remove notification recipients to Jira notification events. Is the problem that, once added, recipients are not receiving notifications? Or that they are not even being added?

Yes, I attempt to filter Service Desk specific notifications.

Following your reply

So you can catch Jira notifications on Service Desk issues such as notifications on Issue created but not on Request created through the portal.

I did some more tests to see if I can at least partly do what I want to, but it seems that notifications are only getting filtered, if you’ve created the issue directly in Jira, rather than letting the customer do it on the portal, which is of course not really helpful, as issues will infact be raised via the portal and by the customer.

In my scenario, the most important requirements would be be to filter comments added by the customer and comments added by a Jira Servicedesk agent.

I know what the SPI does and it works well for everything related to issues not part of a Jira Service Desk queue, no issues with it.

Do you know if there is anything planned to make the filter also work with JSD notifications?


Hi @j.borrmann,

Ah I see. Unfortunately the NotificationFilter SPI is for Jira notifications. You should be able to filter comments added from the Jira agent view for Service Desk issues. However, public comments added sends notifications to customers involved in the request, is a JSD specific notification. Anything in Customer notifications section in a Service Desk project settings is a JSD notification.

You can create a suggestion to add Notification filtering for JSD notifications. Take a look at our new feature policy.

I hope that helps!

1 Like

Thanks, I’ve just created https://jira.atlassian.com/browse/JSDSERVER-6068 which will hopefully get enough attention soon.