Skip to content

Commit

Permalink
Enhances Slack Case Handling and Messaging for Improved Clarity and U…
Browse files Browse the repository at this point in the history
…ser Interaction (#5267)

* Enhances Slack Case Handling and Messaging for Improved Clarity and User Interaction

* improvements

* ruff ruff

* cosmetic changes

* re-adds number of alerts message

---------

Co-authored-by: Will Sheldon <114631109+wssheldon@users.noreply.github.com>
  • Loading branch information
mvilanova and wssheldon authored Oct 1, 2024
1 parent 43758fc commit a3bae3a
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 144 deletions.
16 changes: 5 additions & 11 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2293,20 +2293,20 @@ def send_engagement_response(
if response == MfaChallengeStatus.APPROVED:
title = "Approve"
text = "Confirmation... Success!"
message_text = f":white_check_mark: {engaged_user} confirmed the behavior *is expected*.\n\n *Context Provided* \n```{context_from_user}```"
message_text = f":white_check_mark: {engaged_user} confirmed the behavior as expected.\n\n *Context Provided* \n```{context_from_user}```"
engagement_status = SignalEngagementStatus.approved
else:
title = "MFA Failed"
engagement_status = SignalEngagementStatus.denied

if response == MfaChallengeStatus.EXPIRED:
text = "Confirmation failed, the MFA request timed out. Please have your MFA device ready to accept the push notification and try again."
text = "Confirmation failed, the MFA request timed out. Please, have your MFA device ready to accept the push notification and try again."
elif response == MfaChallengeStatus.DENIED:
text = "User not found in MFA provider. To validate your identity, please register in Duo and try again."
text = f"User {engaged_user} not found in MFA provider. To validate your identity, please register in Duo and try again."
else:
text = "Confirmation failed. You must accept the MFA prompt."

message_text = f":warning: {engaged_user} attempted to confirm the behavior *as expected*, but the MFA validation failed.\n\n **Error Reason**: `{response}`\n\n{text}\n\n *Context Provided* \n```{context_from_user}```\n\n"
message_text = f":warning: {engaged_user} attempted to confirm the behavior as expected, but we ran into an error during MFA validation (`{response}`)\n\n{text}\n\n *Context Provided* \n```{context_from_user}```\n\n"

send_success_modal(
client=client,
Expand Down Expand Up @@ -2365,7 +2365,7 @@ def resolve_case(
case_in = CaseUpdate(
title=case.title,
resolution_reason=CaseResolutionReason.user_acknowledge,
resolution=f"Case resolved through user engagement. User context: {context_from_user}",
resolution=context_from_user,
visibility=case.visibility,
status=CaseStatus.closed,
closed_at=datetime.utcnow(),
Expand All @@ -2385,12 +2385,6 @@ def resolve_case(
client.chat_update(
blocks=blocks, ts=case.conversation.thread_id, channel=case.conversation.channel_id
)
client.chat_postMessage(
text="Case has been resolved.",
channel=case.conversation.channel_id,
thread_ts=case.conversation.thread_id,
)


@app.action(
SignalEngagementActions.deny,
Expand Down
Loading

0 comments on commit a3bae3a

Please sign in to comment.