diff --git a/docs/content/docs/(messaging)/slack-setup.mdx b/docs/content/docs/(messaging)/slack-setup.mdx index dcae2c6bf..f27bb4d79 100644 --- a/docs/content/docs/(messaging)/slack-setup.mdx +++ b/docs/content/docs/(messaging)/slack-setup.mdx @@ -145,19 +145,23 @@ The workspace ID is the `T`-prefixed string in your Slack URL: `https://app.slac ### DM filtering -By default, all DMs are ignored. To allow specific users, add their Slack user IDs. +By default, all DMs are ignored. To allow specific users, add their Slack user IDs. To allow **all users** to message the bot via DM, use the wildcard `*`. -Go to **Settings** → **Messaging Platforms** → Slack card and add user IDs to the **DM Allowed Users** list. +Go to **Settings** → **Messaging Platforms** → Slack card and add user IDs to the **DM Allowed Users** list. To allow all users, add `*` as a user ID. ```toml [messaging.slack] +# Allow specific users dm_allowed_users = ["U01234", "U56789"] + +# Or allow all users with wildcard +dm_allowed_users = ["*"] ``` Permission changes hot-reload within a couple seconds — no restart needed. diff --git a/src/messaging/slack.rs b/src/messaging/slack.rs index d3ace875d..ef9502116 100644 --- a/src/messaging/slack.rs +++ b/src/messaging/slack.rs @@ -204,7 +204,10 @@ async fn handle_message_event( tracing::debug!(channel_id, "DM dropped: dm_allowed_users is empty"); return Ok(()); } + // Allow wildcard "*" to permit all users + let is_wildcard = perms.dm_allowed_users.iter().any(|u| u == "*"); if let Some(ref sender_id) = user_id + && !is_wildcard && !perms.dm_allowed_users.contains(sender_id) { tracing::debug!(