def METHOD_NAME(self, slack_team_identity: SlackTeamIdentity, payload: EventPayload) -> AlertGroup:
    """
    Get AlertGroup instance on Slack message button click or select menu change.
    """
    alert_group = (
        self._get_alert_group_from_action(payload)  # Try to get alert_group_pk from PRESSED button
        or self._get_alert_group_from_message(payload)  # Try to use alert_group_pk from ANY button in message
        or self._get_alert_group_from_slack_message_in_db(slack_team_identity, payload)  # Fetch message from DB
    )
    assert alert_group is not None, "AlertGroup not found"
    # Repair alert group if Slack message is orphaned
    if alert_group.slack_message is None:
        self._repair_alert_group(slack_team_identity, alert_group, payload)
    return alert_group