Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(slack): Expose create case slash command #5295

Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ You can override their values if you wish to do so. Included below are their des
| `/dispatch-notifications-group` | Opens a modal to edit the notifications group. |
| `/dispatch-update-participant` | Opens a modal to update participant metadata. |
| `/dispatch-create-task` | Opens a modal to create an incident task. |
| `/dispatch-create-case` | Opens a modal to create a case. |

### Contact Information Resolver Plugin

Expand Down
9 changes: 9 additions & 0 deletions docs/docs/user-guide/incidents/commander.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ All Slack commands are listed below, or you may view _groups_ of commands relati
- [`/dispatch-update-participant`](#%2Fdispatch-update-participant)
- [`/dispatch-run-workflow`](#%2Fdispatch-list-workflow)
- [`/dispatch-create-task`](#%2Fdispatch-create-task)
- [`/dispatch-create-case`](#%2Fdispatch-create-case)
## People

These commands help manage the people helping resolve the incident.
Expand Down Expand Up @@ -215,3 +216,11 @@ This command will create a task for the current incident.
![](/img/slack-conversation-create-task.png)

</div>

### /dispatch-create-case

This command will create a case for the current incident.

<div style={{textAlign: 'center'}}>

</div>
6 changes: 4 additions & 2 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ def configure(config: SlackConversationConfiguration):
case_command_context_middleware,
]

app.command(config.slack_command_create_case, middleware=[db_middleware])(report_issue)

app.command(config.slack_command_escalate_case, middleware=middleware)(
handle_escalate_case_command
)
Expand Down Expand Up @@ -1711,7 +1713,6 @@ def report_issue(
client: WebClient,
context: BoltContext,
db_session: Session,
shortcut: dict,
):
ack()
initial_description = None
Expand Down Expand Up @@ -1748,7 +1749,8 @@ def report_issue(
callback_id=CaseReportActions.submit,
private_metadata=context["subject"].json(),
).build()
client.views_open(trigger_id=shortcut["trigger_id"], view=modal)

client.views_open(trigger_id=body["trigger_id"], view=modal)


@app.action(CaseReportActions.project_select, middleware=[db_middleware, action_context_middleware])
Expand Down
5 changes: 5 additions & 0 deletions src/dispatch/plugins/dispatch_slack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ class SlackConversationConfiguration(SlackConfiguration):
title="Engage Oncall Command String",
description="Defines the string used to engage an oncall. Must match what is defined in Slack.",
)
slack_command_create_case: str = Field(
"/dispatch-create-case",
title="Create Case Command String",
description="Defines the string used to create a case. Must match what is defined in Slack.",
)
slack_command_update_case: str = Field(
"/dispatch-update-case",
title="Update Case Command String",
Expand Down
4 changes: 4 additions & 0 deletions src/dispatch/plugins/dispatch_slack/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def get_incident_conversation_command_message(
"response_type": "ephemeral",
"text": "Opening a dialog to create a new incident task...",
},
config.slack_command_create_case: {
"response_type": "ephemeral",
"text": "Opening a dialog to create a new case...",
},
}

return command_messages.get(command_string, default)
Expand Down
Loading