Skip to content

[ResponseOps][Slack] Simplify channel configuration #245423

Merged
cnasikas merged 19 commits intoelastic:mainfrom
cnasikas:slack_ui_optional_channels
Dec 17, 2025
Merged

[ResponseOps][Slack] Simplify channel configuration #245423
cnasikas merged 19 commits intoelastic:mainfrom
cnasikas:slack_ui_optional_channels

Conversation

@cnasikas
Copy link
Copy Markdown
Member

@cnasikas cnasikas commented Dec 5, 2025

Summary

Fixes: #230979

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

Release notes

Slack connector can be configured to send messages to any channel using channel names.

@cnasikas cnasikas self-assigned this Dec 5, 2025
@cnasikas cnasikas added release_note:enhancement Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// backport:version Backport to applied version labels v9.3.0 labels Dec 5, 2025
import type { SlackApiConfig } from '@kbn/connector-schemas/slack_api';

export const deserializer = (data: ConnectorFormSchema): InternalConnectorForm => {
const allowedChannels = (data.config?.allowedChannels as SlackApiConfig['allowedChannels']) ?? [];
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The casting is needed because the TS types do not support templates, as they assume the data is the same for all connectors. I opened this issue: #246390.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote everything from scratch as a lot of the functionality was removed.

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [defaultMessage, useDefaultMessage]);

return <SlackParamsFieldsComponent {...props} key={key} />;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key will reset the state (useState) of the component if it changes. This helps to reset the fields when the connector changes.

readOnly,
configFormSchema,
secretsFormSchema,
configFormSchemaAfterSecrets = [],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used by any connector type.

@cnasikas cnasikas marked this pull request as ready for review December 16, 2025 13:50
@cnasikas cnasikas requested a review from a team as a code owner December 16, 2025 13:50
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

Copy link
Copy Markdown
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified changes locally, working as expected with new and existing connectors and rules using those connectors

Few minor things (no blocker)

  1. Channels dropdown is different for Old connector (from main) test tab view than in rules action form
Screenshot 2025-12-16 at 15 47 52

Old rule with old connector (from main)
Screenshot 2025-12-16 at 15 48 11

  1. As discussed offline, Help text with example for allowedChannels field could be helpful.

  2. Also known bug - security solution rule form doesn't show channel on selecting/changing the connector

Copy link
Copy Markdown
Member

@umbopepato umbopepato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

nit: not related to this changes, but like in the Scheduled Reports form and other hook lib forms, the errors accumulate on every validation instead of replacing the old one. If we didn't already, we could inform the relevant team (Core?) to improve this

Image

return channel.name;
}

return `#${channel.name}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can this happen? Did we miss a schema validation to check that channel.name starts with # ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code always put names without #. We can do the same but I thought users are more used to the # on front of channels and it will make it easier to distinguish channel names for channel IDs.

const DEFAULT_PARAMS = { subAction: 'postMessage' as const, subActionParams: { text: undefined } };

const getChannelErrors = (channels?: string[], channelIds?: string[], channelNames?: string[]) => {
const isUndefinedOrEmptyArray = (arr?: string[]) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be moved outside this function to avoid creating it each time

await userEvent.paste('some token');

await userEvent.click(screen.getByTestId('comboBoxSearchInput'));
await userEvent.type(screen.getByTestId('comboBoxSearchInput'), '#general{enter}');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not paste like the token? (just curious)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paste does not work with the combobox or at least I cannot make it work 🙂

return;
}

const areAllValid = valueAsArray.every((value) => value.startsWith('#'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this not accept channel ids anymore? What's the point in forcing # as prefix in the UI then?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not any more. For new usage, we will go with channel names, and the backend will throw an error if the # is not prefixed on the channel name.

Copy link
Copy Markdown
Contributor

@jcger jcger Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no breaking change because it will still be working, it's just that the UI on edit connector will show something broken or nothing in the "Allowed channels" list?

Isn't it weird that a user can set allowed channel ids via API but then the UI will be broken/users can't update via UI this list using the same id they use via API? I would think we keep feature parity between API and UI (meaning both work)

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #113 / Endpoint Policy @ess @serverless Creation of DOT indices for elastic defend policies "before each" hook for "should create indices when endpoint integration policy is created"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
stackConnectors 633 634 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
stackConnectors 1.1MB 1.1MB -3.2KB
triggersActionsUi 1.5MB 1.5MB +33.0B
total -3.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
stackConnectors 76.2KB 76.6KB +391.0B
triggersActionsUi 107.2KB 107.1KB -151.0B
total +240.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
stackConnectors 155 151 -4

References to deprecated APIs

id before after diff
stackConnectors 2 1 -1

Total ESLint disabled count

id before after diff
stackConnectors 160 156 -4

History

cc @cnasikas

@cnasikas cnasikas merged commit 0bf64ab into elastic:main Dec 17, 2025
14 checks passed
@cnasikas cnasikas deleted the slack_ui_optional_channels branch December 17, 2025 13:14
@kibanamachine kibanamachine added backport:skip This PR does not require backporting and removed backport:version Backport to applied version labels labels Dec 17, 2025
mbondyra added a commit to mbondyra/kibana that referenced this pull request Dec 17, 2025
…donly

* commit 'bb1f55fa520b30ceb923af069ef403b24dcb1606': (52 commits)
  [CPS][Maps] Support CPS Picker in Maps  (elastic#246382)
  [APM] Migrate the Transaction Overview tests to Scout/Playwright/Component/API tests (elastic#245972)
  [Cases] Change nested field search to be case insensitive (elastic#246643)
  [ES|QL] PromQL parser initial implementation (elastic#246552)
  [Agent Builder] Adds keyboard shortcut and toggle behavior to AI Agent button (elastic#246659)
  Retry on "all shards failed" from ES (elastic#246533)
  [Streams] Test enable wired streams flow (elastic#246113)
  [Agent Builder] Fast-follow bugfixes for MCP Tool type  (elastic#246665)
  [Entity Store][API] Fix snake case on CRUD API List response (elastic#246003)
  [ResponseOps][Slack] Simplify channel configuration  (elastic#245423)
  Add Canonical Name Badge to Documentation (elastic#246647)
  [Streams] Add simulation filtering by conditions (elastic#245400)
  [o11y AI] Add `get_hosts` tool (elastic#246541)
  [agent builder] create_visualization: support heatmap and regionmap (elastic#246671)
  [AI Infra] Chat experience: Selection modal title change (elastic#246683)
  [Background search] Change polling behavior (elastic#244760)
  [ES|QL  ]  Common Lookup Join Fields Are Not Listed First (elastic#246582)
  Add missing `dynamic: false` (elastic#246685)
  [Metrics in Discover] Unskip metrics api test (elastic#246593)
  [ES|QL] Show next actions after simple field assignment in RERANK ON Clause (elastic#246676)
  ...
KodeRad pushed a commit to KodeRad/kibana that referenced this pull request Dec 17, 2025
## Summary

Fixes: elastic#230979


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
cnasikas added a commit that referenced this pull request Dec 19, 2025
…g Slack connector (#247098)

## Summary

PR #245423 simplified a lot the
logic of the Slack connector regarding channels. This PR fixes a small
bug introduced in the PR where it would remove the ID of the channel
from the payload for existing connector.

### Testing

1. Create a connector using the following payload:

```
{
    "name": "Slack - test allowedChannels",
    "config": {
        "allowedChannels": [
            {
                "id": "C096LSBJZBQ", // should have an ID
                "name": "test"
            }
        ]
    },
    "secrets": {
        "token": "foo"
    },
    "connector_type_id": ".slack_api"
}
```

2. Edit the connector by adding an extra channel
3. Verify that the payload sent to the API preserves the channel ID. The
new channel should only have a name.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 19, 2025
…g Slack connector (elastic#247098)

## Summary

PR elastic#245423 simplified a lot the
logic of the Slack connector regarding channels. This PR fixes a small
bug introduced in the PR where it would remove the ID of the channel
from the payload for existing connector.

### Testing

1. Create a connector using the following payload:

```
{
    "name": "Slack - test allowedChannels",
    "config": {
        "allowedChannels": [
            {
                "id": "C096LSBJZBQ", // should have an ID
                "name": "test"
            }
        ]
    },
    "secrets": {
        "token": "foo"
    },
    "connector_type_id": ".slack_api"
}
```

2. Edit the connector by adding an extra channel
3. Verify that the payload sent to the API preserves the channel ID. The
new channel should only have a name.

### Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 2dce199)
baileycash-elastic pushed a commit to baileycash-elastic/kibana that referenced this pull request Dec 19, 2025
…g Slack connector (elastic#247098)

## Summary

PR elastic#245423 simplified a lot the
logic of the Slack connector regarding channels. This PR fixes a small
bug introduced in the PR where it would remove the ID of the channel
from the payload for existing connector.

### Testing

1. Create a connector using the following payload:

```
{
    "name": "Slack - test allowedChannels",
    "config": {
        "allowedChannels": [
            {
                "id": "C096LSBJZBQ", // should have an ID
                "name": "test"
            }
        ]
    },
    "secrets": {
        "token": "foo"
    },
    "connector_type_id": ".slack_api"
}
```

2. Edit the connector by adding an extra channel
3. Verify that the payload sent to the API preserves the channel ID. The
new channel should only have a name.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
kibanamachine added a commit that referenced this pull request Dec 23, 2025
…xisting Slack connector (#247098) (#247159)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[ResponseOps][Connectors] Keep the channel ID when editing an
existing Slack connector
(#247098)](#247098)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"christos.nasikas@elastic.co"},"sourceCommit":{"committedDate":"2025-12-19T17:52:58Z","message":"[ResponseOps][Connectors]
Keep the channel ID when editing an existing Slack connector
(#247098)\n\n## Summary\n\nPR
#245423 simplified a lot
the\nlogic of the Slack connector regarding channels. This PR fixes a
small\nbug introduced in the PR where it would remove the ID of the
channel\nfrom the payload for existing connector.\n\n### Testing\n\n1.
Create a connector using the following payload:\n\n```\n{\n \"name\":
\"Slack - test allowedChannels\",\n \"config\": {\n \"allowedChannels\":
[\n {\n \"id\": \"C096LSBJZBQ\", // should have an ID\n \"name\":
\"test\"\n }\n ]\n },\n \"secrets\": {\n \"token\": \"foo\"\n },\n
\"connector_type_id\": \".slack_api\"\n}\n```\n\n2. Edit the connector
by adding an extra channel\n3. Verify that the payload sent to the API
preserves the channel ID. The\nnew channel should only have a
name.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"2dce199c0d7c2c38f1c6f92789ee5f7469dec4b5","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:ResponseOps","backport:version","v9.3.0","v9.4.0"],"title":"[ResponseOps][Connectors]
Keep the channel ID when editing an existing Slack
connector","number":247098,"url":"https://github.com/elastic/kibana/pull/247098","mergeCommit":{"message":"[ResponseOps][Connectors]
Keep the channel ID when editing an existing Slack connector
(#247098)\n\n## Summary\n\nPR
#245423 simplified a lot
the\nlogic of the Slack connector regarding channels. This PR fixes a
small\nbug introduced in the PR where it would remove the ID of the
channel\nfrom the payload for existing connector.\n\n### Testing\n\n1.
Create a connector using the following payload:\n\n```\n{\n \"name\":
\"Slack - test allowedChannels\",\n \"config\": {\n \"allowedChannels\":
[\n {\n \"id\": \"C096LSBJZBQ\", // should have an ID\n \"name\":
\"test\"\n }\n ]\n },\n \"secrets\": {\n \"token\": \"foo\"\n },\n
\"connector_type_id\": \".slack_api\"\n}\n```\n\n2. Edit the connector
by adding an extra channel\n3. Verify that the payload sent to the API
preserves the channel ID. The\nnew channel should only have a
name.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"2dce199c0d7c2c38f1c6f92789ee5f7469dec4b5"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/247098","number":247098,"mergeCommit":{"message":"[ResponseOps][Connectors]
Keep the channel ID when editing an existing Slack connector
(#247098)\n\n## Summary\n\nPR
#245423 simplified a lot
the\nlogic of the Slack connector regarding channels. This PR fixes a
small\nbug introduced in the PR where it would remove the ID of the
channel\nfrom the payload for existing connector.\n\n### Testing\n\n1.
Create a connector using the following payload:\n\n```\n{\n \"name\":
\"Slack - test allowedChannels\",\n \"config\": {\n \"allowedChannels\":
[\n {\n \"id\": \"C096LSBJZBQ\", // should have an ID\n \"name\":
\"test\"\n }\n ]\n },\n \"secrets\": {\n \"token\": \"foo\"\n },\n
\"connector_type_id\": \".slack_api\"\n}\n```\n\n2. Edit the connector
by adding an extra channel\n3. Verify that the payload sent to the API
preserves the channel ID. The\nnew channel should only have a
name.\n\n\n### Checklist\n\nCheck the PR satisfies following conditions.
\n\nReviewers should verify this PR satisfies this list as well.\n\n-
[x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common
scenarios","sha":"2dce199c0d7c2c38f1c6f92789ee5f7469dec4b5"}}]}]
BACKPORT-->

Co-authored-by: Christos Nasikas <christos.nasikas@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Jan 6, 2026
…g Slack connector (elastic#247098)

## Summary

PR elastic#245423 simplified a lot the
logic of the Slack connector regarding channels. This PR fixes a small
bug introduced in the PR where it would remove the ID of the channel
from the payload for existing connector.

### Testing

1. Create a connector using the following payload:

```
{
    "name": "Slack - test allowedChannels",
    "config": {
        "allowedChannels": [
            {
                "id": "C096LSBJZBQ", // should have an ID
                "name": "test"
            }
        ]
    },
    "secrets": {
        "token": "foo"
    },
    "connector_type_id": ".slack_api"
}
```

2. Edit the connector by adding an extra channel
3. Verify that the payload sent to the API preserves the channel ID. The
new channel should only have a name.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
dej611 pushed a commit to dej611/kibana that referenced this pull request Jan 8, 2026
…g Slack connector (elastic#247098)

## Summary

PR elastic#245423 simplified a lot the
logic of the Slack connector regarding channels. This PR fixes a small
bug introduced in the PR where it would remove the ID of the channel
from the payload for existing connector.

### Testing

1. Create a connector using the following payload:

```
{
    "name": "Slack - test allowedChannels",
    "config": {
        "allowedChannels": [
            {
                "id": "C096LSBJZBQ", // should have an ID
                "name": "test"
            }
        ]
    },
    "secrets": {
        "token": "foo"
    },
    "connector_type_id": ".slack_api"
}
```

2. Edit the connector by adding an extra channel
3. Verify that the payload sent to the API preserves the channel ID. The
new channel should only have a name.


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:enhancement Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ResponseOps][Connectors] Make the allow list optional and accept channel names when using the Slack connector

6 participants