Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/dispatch/case/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,19 @@ def case_new_create_flow(
elif case.event:
# no one has been paged, inform the channel that they can
# engage the oncall if the priority changes
send_event_paging_message(case, db_session)
oncall_name = "the relevant team"

try:
if case.case_type and case.case_type.oncall_service:
oncall_service = service_service.get_by_external_id(
db_session=db_session,
external_id=case.case_type.oncall_service.external_id,
)
oncall_name = oncall_service.name
except Exception as e:
log.error(f"Failed to get oncall service: {e}. Falling back to default oncall_name string.")

send_event_paging_message(case, db_session, oncall_name)

if case and case.case_type.auto_close:
# we transition the case to the closed state if its case type has auto close enabled
Expand Down
4 changes: 2 additions & 2 deletions src/dispatch/case/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def send_case_welcome_participant_message(
log.debug(f"Welcome ephemeral message sent to {participant_email}.")


def send_event_paging_message(case: Case, db_session: Session):
def send_event_paging_message(case: Case, db_session: Session, oncall_name: str) -> None:
"""
Sends a message to the case conversation channel to notify the reporter that they can engage
with oncall if they need immediate assistance.
Expand All @@ -400,7 +400,7 @@ def send_event_paging_message(case: Case, db_session: Session):
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"This event was reported and the team will respond during normal business hours. If you end up needing immediate assistance, you can engage the oncall with `{engage_oncall_command}`.",
"text": f"This event was reported and the team will respond during normal business hours. If you end up needing immediate assistance, you can engage `{oncall_name}` with `{engage_oncall_command}` and selecting the 'Page' option.",
},
},
]
Expand Down
Loading