PagerDuty Implementation

Sym integrates with PagerDuty to access on-call schedules in Handlers.

Using PagerDuty in your Flows

This section is for Sym Implementers!

If your PagerDuty Integration has not yet been set up, please point your Integrator to Setup PagerDuty.

πŸ‘

SDK Docs

The PagerDuty Integration is defined at sym.sdk.integrations.pagerduty.

You can use information about oncalls in your Flows.

Example Usage

Allowing self-approvals when a User is on call

from sym.sdk.annotations import hook, reducer
from sym.sdk.integrations import pagerduty, slack

@reducer
def get_approvers(evt):
    # In this example, being on call allows for self-approvals.
    
    # This branch is triggered if the User is on call 
    # in any escalation policy of the PagerDuty account
    if pagerduty.is_on_call(evt.user):
        # This is a self-approval in a DM
        return slack.user(evt.user)

Fetch an on-call schedule of managers to route an approval

from sym.sdk.annotations import hook, reducer
from sym.sdk.integrations import pagerduty, slack

@reducer
def get_approvers(evt):
    # In this example, the manager schedule is fetched,
    # and every User currently on call is put in a group
    # to approve the request.
        on_call_mgrs = pagerduty.users_on_call(escalation_policy_name="mgr_on_call")
        return slack.group(on_call_mgrs)

Did this page help you?