Reducers run at specific points in the flow defined by the Sym
processor, and provide critical context for Flow execution.
The only required reducer. Accepts an
from sym.sdk.annotations import reducer from sym.sdk.integrations import pagerduty, okta, slack # Reducers can be mandatory, and provide dynamic config values @reducer def get_approvers(evt): """Returns a set of approvers, given a user and a target.""" # The import here uses credentials defined in an Integration in Terraform if pagerduty.is_on_call(evt.user, schedule="id_of_eng_on_call"): # This is a self-approval in a DM return slack.user(evt.user) if evt.payload.fields["urgency"] == "High": # This is a self-approval in a channel return slack.channel("#break-glass", allow_self=True) on_call_mgrs = okta.group("OnCallManagers").members() # This would create a group DM for on-call managers return slack.group(on_call_mgrs)
Updated about 2 months ago