handlers.create_subscription_handler

class CreateSubscriptionHandler(handlers.eventhandler.EventHandler):

Whenever somebody creates an Application, we want them to be automatically subscribed to it so that we don't get any orphaned applications. So if we receive a FactSheetCreatedEvent for an Application fact sheet, this handler creates a RESPONSIBLE subscription for the user who created the fact sheet. Note that we don't add a subscription if the acting user is in the exception list.

Runtime Configuration:
fs_types: List of fact sheet types for which this automation will be active. E.g. ["Application"]

role:
name: The name of the subscription role that you want to subscribe.
type: The subscription type of the subscription (RESPONSIBLE, ACCOUNTABLE or OBSERVER).

ignore_technical_users: true or false. If set to true, don't subscribe if the fact sheet was created by a technical user.

exceptions: List of e-mail addresses of users that should not be auto-subscribed, e.g. LeanIX admin users.

name = 'Auto-Subscribe on Fact Sheet Creation'
description = 'When somebody creates a fact sheet, the creating user is auto-subscribed to the fact sheet.'
conditions = {'event_types': ['FactSheetCreatedEvent']}
config_template = {'fs_types': ['Application'], 'ignore_technical_users': True, 'role': {'type': 'RESPONSIBLE', 'name': 'Manager L1'}, 'exceptions': ['admin1@domain.com', 'admin2@domain.com']}
def handle(self, event, fact_sheet, **kwargs):

Called automatically whenever a FactSheetCreated or FactSheetUpdated event comes in via webhook.