How to write a TeamCity notification plugin which will execute with no subscribed users

I'm trying to write a plugin to handle notifications via a third party app which runs on iOS, Android and Windows phones. The app itself handles the user subscriptions, TeamCity does not [need to] handle the subscriptions.
The TeamCity plugin docs say:

  • Notifications are only delivered if there is at least one subscribed user for given event.

The api has methods which include a collection of subscribed users:

  • public void notifyBuildSuccessful(SRunningBuild sRunningBuild, Set sUsers);

How can I get TeamCity to call my notification plugin even though there will be no users registering as plugin subscribers through TeamCity itself?

1 comment
Comment actions Permalink

This is the answer I received to the same question on stacxkoverflow:

There are two ways to approach custom notifications in TeamCity:

    1. Use TeamCity user's notification rules and just implement a new way of notification delivery. This is how TeamCity bundled notifications are implemented (email, Jabber, etc.)
    2. Listen for all the relevant system events, decide in your code which users for what events to notify and send out those notifications.

The first approach is described in TeamCity documentation which you refer to.

The second one is to register for all server events and process them as you like. WebHooks plugin has anexample of the approach. A related note: If processing an even can take time, I'd recommend to do that asynchronously in order not to stall the server by slow server events processing.


Please sign in to leave a comment.