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

[RAM] Docs for slack improvements #153885

Merged
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f88e68
add test which create auto snapshots for slack connector
guskovaue Mar 8, 2023
8d7ee38
add preconfigured web api connector section
guskovaue Mar 22, 2023
8815a62
create Configure a Slack account with Web AP
guskovaue Mar 28, 2023
81777d7
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
guskovaue Mar 28, 2023
64f998b
addition to previous comment
guskovaue Mar 28, 2023
ef3df61
attempt to write openapi
guskovaue Mar 28, 2023
c6fbfea
[DOCS] Add enumerated data type in update_connector_request_slack.yaml
lcawl Mar 29, 2023
d42e63f
[DOCS] Uncomment update_connector_request_slack.yaml
lcawl Mar 29, 2023
b8b2397
[DOCS] Generate API doc output
lcawl Mar 29, 2023
005360e
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
guskovaue Mar 29, 2023
c1d1fc9
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Mar 29, 2023
156ee4c
write openapi docs
guskovaue Mar 29, 2023
bf55d9e
Merge branch 'RAM-152880-change-docs-for-slack-improvements' of githu…
guskovaue Mar 29, 2023
947291f
delete old file
guskovaue Mar 29, 2023
65c26c5
[DOCS] Re-add configuring-slack anchor
lcawl Mar 29, 2023
9ed200a
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
guskovaue Apr 25, 2023
ef43470
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Apr 25, 2023
7aeb227
Update docs/management/connectors/action-types/slack.asciidoc
guskovaue Apr 25, 2023
7c82f75
changes after separating slack connectors
guskovaue Apr 25, 2023
8a9d0c7
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
guskovaue Apr 25, 2023
c1badca
test for automated screenshots
guskovaue Apr 27, 2023
f354bb2
change api docs
guskovaue Apr 27, 2023
739b7ce
[DOCS] Regenerate connector-apis-passthru.asciidoc
lcawl Apr 27, 2023
50a4f6b
uncomment what was commented
guskovaue Apr 28, 2023
6597de2
Merge branch 'RAM-152880-change-docs-for-slack-improvements' of githu…
guskovaue Apr 28, 2023
751ed10
[DOCS] Add automate screenshots
lcawl Apr 28, 2023
5276631
[DOCS] Describe differences between connector types
lcawl May 1, 2023
7a112a5
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
lcawl May 2, 2023
4ba21d6
Edits slack connector message text
lcawl May 2, 2023
2032e4b
Edit channel validation message
lcawl May 2, 2023
eafb15c
Merge branch 'main' into RAM-152880-change-docs-for-slack-improvements
guskovaue May 3, 2023
0918ba9
fix a message line
guskovaue May 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion docs/api-generated/connectors/connector-apis-passthru.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,9 @@ Any modifications made to this file will be overwritten.
<li><a href="#secrets_properties_opsgenie"><code>secrets_properties_opsgenie</code> - Connector secrets properties for an Opsgenie connector</a></li>
<li><a href="#secrets_properties_resilient"><code>secrets_properties_resilient</code> - Connector secrets properties for IBM Resilient connector</a></li>
<li><a href="#secrets_properties_servicenow"><code>secrets_properties_servicenow</code> - Connector secrets properties for ServiceNow ITOM, ServiceNow ITSM, and ServiceNow SecOps connectors</a></li>
<li><a href="#secrets_properties_slack"><code>secrets_properties_slack</code> - Connector secrets properties for a Slack connector</a></li>
<li><a href="#secrets_properties_slack_oneOf"><code>secrets_properties_slack_oneOf</code> - </a></li>
<li><a href="#secrets_properties_slack_oneOf_1"><code>secrets_properties_slack_oneOf_1</code> - </a></li>
<li><a href="#secrets_properties_swimlane"><code>secrets_properties_swimlane</code> - Connector secrets properties for a Swimlane connector</a></li>
<li><a href="#updateConnector_400_response"><code>updateConnector_400_response</code> - </a></li>
<li><a href="#update_connector_request_cases_webhook"><code>update_connector_request_cases_webhook</code> - Update Webhook - Case Managment connector request</a></li>
Expand All @@ -1025,6 +1028,7 @@ Any modifications made to this file will be overwritten.
<li><a href="#update_connector_request_serverlog"><code>update_connector_request_serverlog</code> - Update server log connector request</a></li>
<li><a href="#update_connector_request_servicenow"><code>update_connector_request_servicenow</code> - Update ServiceNow ITSM connector or ServiceNow SecOps request</a></li>
<li><a href="#update_connector_request_servicenow_itom"><code>update_connector_request_servicenow_itom</code> - Create ServiceNow ITOM connector request</a></li>
<li><a href="#update_connector_request_slack"><code>update_connector_request_slack</code> - Update Slack connector request</a></li>
<li><a href="#update_connector_request_swimlane"><code>update_connector_request_swimlane</code> - Update Swimlane connector request</a></li>
</ol>

Expand Down Expand Up @@ -1773,7 +1777,7 @@ Any modifications made to this file will be overwritten.
<div class="param-enum-header">Enum:</div>
<div class="param-enum">.slack</div>
<div class="param">name </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The display name for the connector. </div>
<div class="param">secrets </div><div class="param-desc"><span class="param-type"><a href="#AnyType">map[String, oas_any_type_not_mapped]</a></span> Defines secrets for connectors when type is <code>.slack</code>. </div>
<div class="param">secrets </div><div class="param-desc"><span class="param-type"><a href="#secrets_properties_slack">secrets_properties_slack</a></span> </div>
</div> <!-- field-items -->
</div>
<div class="model">
Expand Down Expand Up @@ -2220,6 +2224,28 @@ Any modifications made to this file will be overwritten.
<div class="param">username (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The username for HTTP basic authentication. This property is required when <code>isOAuth</code> is <code>false</code>. </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="secrets_properties_slack"><code>secrets_properties_slack</code> - Connector secrets properties for a Slack connector</a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'>Defines secrets for connectors when type is <code>.slack</code>.</div>
<div class="field-items">
<div class="param">token </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The Slack bot user OAuth token. </div>
<div class="param">webhookUrl </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The Slack webhook url. </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="secrets_properties_slack_oneOf"><code>secrets_properties_slack_oneOf</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">token </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The Slack bot user OAuth token. </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="secrets_properties_slack_oneOf_1"><code>secrets_properties_slack_oneOf_1</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">webhookUrl </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The Slack webhook url. </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="secrets_properties_swimlane"><code>secrets_properties_swimlane</code> - Connector secrets properties for a Swimlane connector</a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'>Defines secrets for connectors when type is <code>.swimlane</code>.</div>
Expand Down Expand Up @@ -2305,6 +2331,17 @@ Any modifications made to this file will be overwritten.
<div class="param">secrets </div><div class="param-desc"><span class="param-type"><a href="#secrets_properties_servicenow">secrets_properties_servicenow</a></span> </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="update_connector_request_slack"><code>update_connector_request_slack</code> - Update Slack connector request</a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">name </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> The display name for the connector. </div>
<div class="param">config (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-enum-header">Enum:</div>
<div class="param-enum">web_api</div><div class="param-enum">webhook</div>
<div class="param">secrets </div><div class="param-desc"><span class="param-type"><a href="#secrets_properties_slack">secrets_properties_slack</a></span> </div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="update_connector_request_swimlane"><code>update_connector_request_swimlane</code> - Update Swimlane connector request</a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
Expand Down
57 changes: 39 additions & 18 deletions docs/management/connectors/action-types/slack.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,43 @@ image::management/connectors/images/slack-connector.png[Slack connector]
[[slack-connector-configuration]]
==== Connector configuration

Slack connectors have the following configuration properties:

Name:: The name of the connector.
Webhook URL:: The URL of the incoming webhook. See https://api.slack.com/messaging/webhooks#getting_started[Slack Incoming Webhooks] for instructions on generating this URL. If you are using the <<action-settings, `xpack.actions.allowedHosts`>> setting, make sure the hostname is added to the allowed hosts.
Slack connectors have a name and either a webhook URL or an API token.
To set up your Slack account and obtain these values, go to <<configuring-slack>>.

[float]
[[preconfigured-slack-configuration]]
=== Create preconfigured connectors

If you are running {kib} on-prem, you can define connectors by
adding `xpack.actions.preconfigured` settings to your `kibana.yml` file.
For example:

.Example Slack connector with webhook
[source,text]
--
xpack.actions.preconfigured:
my-slack:
name: preconfigured-slack-connector-type
actionTypeId: .slack
config:
type: 'webhook'
secrets:
webhookUrl: 'https://hooks.slack.com/services/abcd/efgh/ijklmnopqrstuvwxyz'
webhookUrl: 'https://hooks.slack.com/services/xxxx/xxxx/xxxx' <1>
--
<1> To obtain this value, go to <<configuring-slack-webhook>>.

Secrets defines sensitive information for the connector type.

`webhookUrl`:: A string that corresponds to *Webhook URL*.
.Example Slack connector with web API
[source,text]
--
xpack.actions.preconfigured:
my-slack:
name: preconfigured-slack-connector-type
actionTypeId: .slack
config:
type: 'web_api'
secrets:
token: 'xoxb-xxxx-xxxx-xxxx' <1>
--
<1> To obtain this value, go to <<configuring-slack-web-api>>.

[float]
[[slack-action-configuration]]
Expand All @@ -69,16 +80,26 @@ Use the <<action-settings,Action configuration settings>> to customize connector

[float]
[[configuring-slack]]
==== Configure a Slack account
=== Configure a Slack account

You need a https://api.slack.com/incoming-webhooks[Slack webhook URL] to
configure a Slack account. To create a webhook
URL, set up an an **Incoming Webhook Integration** through the Slack console:
Before you can create a Slack connector, you must configure your account and obtain the necessary URL or token.

[float]
[[configuring-slack-webhook]]
lcawl marked this conversation as resolved.
Show resolved Hide resolved
==== Configure a Slack account with Webhook

. Log in to http://slack.com[slack.com] as a team administrator.
. Go to https://my.slack.com/services/new/incoming-webhook.
. Select a default channel for the integration.
+
image::images/slack-add-webhook-integration.png[]
. Click *Add Incoming Webhook Integration*.
. Follow first 3 paragraphs of https://api.slack.com/messaging/webhooks.
guskovaue marked this conversation as resolved.
Show resolved Hide resolved
. Copy the generated webhook URL so you can paste it into your Slack connector form.
. If you are using the <<action-settings,`xpack.actions.allowedHosts`>> setting, make sure the hostname from the URL is added to the allowed hosts.
lcawl marked this conversation as resolved.
Show resolved Hide resolved

[float]
[[configuring-slack-web-api]]
==== Configure a Slack account with Web API

. Create a Slack app. Refer to https://api.slack.com/authentication/basics#creating.
. Add scope: `channels:read`, `groups:read`, `chat:write` and `chat:write.public`. Refer to https://api.slack.com/authentication/basics#scopes.
. Install the app to a workspace. Refer to https://api.slack.com/authentication/basics#installing.
. Copy the `Bot User OAuth Token` so you can paste it into your Slack connector form.
. If you need to send messages to a private channel, you need to write `/invite @App_name` in it.
Putting "@" triggers Slack to start auto-suggesting, which is why it then becomes easy to find your app name in the list.
55 changes: 53 additions & 2 deletions x-pack/plugins/actions/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@
{
"$ref": "#/components/schemas/update_connector_request_servicenow_itom"
},
{
"$ref": "#/components/schemas/update_connector_request_slack"
},
{
"$ref": "#/components/schemas/update_connector_request_swimlane"
}
Expand Down Expand Up @@ -1948,8 +1951,32 @@
"secrets_properties_slack": {
"title": "Connector secrets properties for a Slack connector",
"description": "Defines secrets for connectors when type is `.slack`.",
"type": "object",
"additionalProperties": true
"oneOf": [
{
"type": "object",
"required": [
"token"
],
"properties": {
"token": {
"type": "string",
"description": "The Slack bot user OAuth token."
}
}
},
{
"type": "object",
"required": [
"webhookUrl"
],
"properties": {
"webhookUrl": {
"type": "string",
"description": "The Slack webhook url."
}
}
}
]
},
"create_connector_request_slack": {
"title": "Create Slack connector request",
Expand Down Expand Up @@ -3348,6 +3375,30 @@
}
}
},
"update_connector_request_slack": {
"title": "Update Slack connector request",
"type": "object",
"required": [
"name",
"secrets"
],
"properties": {
"name": {
"type": "string",
"description": "The display name for the connector."
},
"config": {
"type": "string",
"enum": [
"web_api",
"webhook"
]
},
"secrets": {
"$ref": "#/components/schemas/secrets_properties_slack"
}
}
},
"update_connector_request_swimlane": {
"title": "Update Swimlane connector request",
"type": "object",
Expand Down
35 changes: 33 additions & 2 deletions x-pack/plugins/actions/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ paths:
- $ref: '#/components/schemas/update_connector_request_serverlog'
- $ref: '#/components/schemas/update_connector_request_servicenow'
- $ref: '#/components/schemas/update_connector_request_servicenow_itom'
- $ref: '#/components/schemas/update_connector_request_slack'
- $ref: '#/components/schemas/update_connector_request_swimlane'
examples:
updateIndexConnectorRequest:
Expand Down Expand Up @@ -1300,8 +1301,21 @@ components:
secrets_properties_slack:
title: Connector secrets properties for a Slack connector
description: Defines secrets for connectors when type is `.slack`.
type: object
additionalProperties: true
oneOf:
- type: object
required:
- token
properties:
token:
type: string
description: The Slack bot user OAuth token.
- type: object
required:
- webhookUrl
properties:
webhookUrl:
type: string
description: The Slack webhook url.
create_connector_request_slack:
title: Create Slack connector request
description: The Slack connector uses Slack Incoming Webhooks.
Expand Down Expand Up @@ -2318,6 +2332,23 @@ components:
description: The display name for the connector.
secrets:
$ref: '#/components/schemas/secrets_properties_servicenow'
update_connector_request_slack:
title: Update Slack connector request
type: object
required:
- name
- secrets
properties:
name:
type: string
description: The display name for the connector.
config:
type: string
enum:
- web_api
- webhook
secrets:
$ref: '#/components/schemas/secrets_properties_slack'
update_connector_request_swimlane:
title: Update Swimlane connector request
type: object
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Connector secrets properties for a Web API Slack connector
description: Defines secrets for connectors when type is `.slack`.
required:
- token
type: object
properties:
token:
type: string
description: Slack bot user OAuth token.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Connector secrets properties for a Webhook Slack connector
description: Defines secrets for connectors when type is `.slack`.
required:
- token
type: object
properties:
webhookUrl:
type: string
description: Slack webhook url.
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
title: Update Slack connector request
type: object
required:
- config
- name
- secrets
properties:
name:
type: string
description: The display name for the connector.
config:
type: string
enum:
- web_api
- webhook
secrets:
$ref: 'secrets_properties_slack.yaml'
type: object
description: The secrets object containing the necessary fields for authentication.
oneOf:
- $ref: 'secrets_properties_slack_web_api.yaml'
- $ref: 'secrets_properties_slack_webhook.yaml'
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ put:
- $ref: '../components/schemas/update_connector_request_serverlog.yaml'
- $ref: '../components/schemas/update_connector_request_servicenow.yaml'
- $ref: '../components/schemas/update_connector_request_servicenow_itom.yaml'
# - $ref: '../components/schemas/update_connector_request_slack.yaml'
- $ref: '../components/schemas/update_connector_request_slack.yaml'
- $ref: '../components/schemas/update_connector_request_swimlane.yaml'
# - $ref: '../components/schemas/update_connector_request_teams.yaml'
# - $ref: '../components/schemas/update_connector_request_tines.yaml'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,24 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const flyOutCancelButton = await testSubjects.find('euiFlyoutCloseButton');
await flyOutCancelButton.click();
});

it('slack connector screenshots', async () => {
await pageObjects.common.navigateToApp('connectors');
await pageObjects.header.waitUntilLoadingHasFinished();
await actions.common.openNewConnectorForm('slack');
await testSubjects.setValue('nameInput', 'Slack test connector');
await testSubjects.click('webApiButton');
await testSubjects.setValue('secrets.token-input', 'xoxb-XXXX-XXXX-XXXX');
await commonScreenshots.takeScreenshot('slack-connector-web-api', screenshotDirectories);
await testSubjects.click('webhookButton');
await testSubjects.setValue(
'slackWebhookUrlInput',
'https://hooks.slack.com/services/abcd/ljklmnopqrstuvwxz'
);
await commonScreenshots.takeScreenshot('slack-connector-webhook', screenshotDirectories);
await testSubjects.click('create-connector-flyout-save-test-btn');
await commonScreenshots.takeScreenshot('slack-params-test', screenshotDirectories);
await testSubjects.click('euiFlyoutCloseButton');
});
});
}