diff --git a/src/dispatch/plugins/dispatch_slack/case/messages.py b/src/dispatch/plugins/dispatch_slack/case/messages.py index c9a0d6c51005..bf197fdf1cb2 100644 --- a/src/dispatch/plugins/dispatch_slack/case/messages.py +++ b/src/dispatch/plugins/dispatch_slack/case/messages.py @@ -204,12 +204,20 @@ def create_signal_messages(case_id: int, channel_id: str, db_session: Session) - action_id=SignalNotificationActions.snooze, value=button_metadata, ), + ] + # The button URL must have at least one character. + # Otherwise, Slack will raise a Validation error. + # external_url is not a required field. If it's empty, an empty list is added, + # which effectively doesn't add anything to the elements list. + + [ Button( text="Response Plan", action_id="button-link", url=first_instance_signal.external_url, - ), + ) ] + if first_instance_signal.external_url + else [] ), Section(text="*Alerts*"), Divider(),