diff --git a/api_docs/outgoing-webhooks.md b/api_docs/outgoing-webhooks.md index e676d0696d..7413bc3644 100644 --- a/api_docs/outgoing-webhooks.md +++ b/api_docs/outgoing-webhooks.md @@ -149,6 +149,10 @@ Here's how we fill in the fields that a Slack-format webhook expects: text The content of the message (in Markdown) + + + command + The bot mention trigger_word @@ -173,8 +177,8 @@ The above data is posted as list of tuples (not JSON), here's an example: ('timestamp', 1532078950), ('user_id', 'U21'), ('user_name', 'Full Name'), - ('command', '@**test**'), - ('text', 'The content of the message'), + ('command', '/test'), + ('text', 'content'), ('trigger_word', 'mention'), ('service_id', 27)] ``` diff --git a/zerver/lib/outgoing_webhook.py b/zerver/lib/outgoing_webhook.py index 0123f2e32d..df74c08052 100644 --- a/zerver/lib/outgoing_webhook.py +++ b/zerver/lib/outgoing_webhook.py @@ -137,7 +137,7 @@ class SlackOutgoingWebhookService(OutgoingWebhookServiceInterface): command_re = r"(@\*\*[\w]+\*\*)" text = event["command"] message_parts = re.split(command_re, text) - if re.fullmatch(command_re, message_parts[1]): + if len(message_parts) == 3 and re.fullmatch(command_re, message_parts[1]): slash_command = "/" + message_parts[1][3:-2] text = message_parts[2].strip()