From d8e4cf59971c6ea561e9ae19925303b6cf843288 Mon Sep 17 00:00:00 2001 From: Viduni Wickramarachchi Date: Mon, 11 Nov 2024 13:53:35 -0500 Subject: [PATCH] [Obs AI Assistant] Update schema of the slack connecor (#185028) --- .../server/rule_connector/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts index c846db02902bb..acfdf63731541 100644 --- a/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts +++ b/x-pack/plugins/observability_solution/observability_ai_assistant_app/server/rule_connector/index.ts @@ -23,7 +23,6 @@ import { JiraParamsSchema, PagerdutyParamsSchema, SlackApiParamsSchema, - SlackParamsSchema, WebhookParamsSchema, } from '@kbn/stack-connectors-plugin/server'; import { ObservabilityAIAssistantRouteHandlerResources } from '@kbn/observability-ai-assistant-plugin/server/routes/types'; @@ -42,9 +41,16 @@ import { OBSERVABILITY_AI_ASSISTANT_CONNECTOR_ID } from '../../common/rule_conne const CONNECTOR_PRIVILEGES = ['api:observabilityAIAssistant', 'app:observabilityAIAssistant']; +export const SlackConnectorParamsSchema = schema.object({ + id: schema.string({ minLength: 1 }), + params: schema.object({ + message: schema.string({ minLength: 1 }), + }), +}); + const connectorParamsSchemas: Record = { '.slack_api': convertSchemaToOpenApi(SlackApiParamsSchema), - '.slack': convertSchemaToOpenApi(SlackParamsSchema), + '.slack': convertSchemaToOpenApi(SlackConnectorParamsSchema), '.email': convertSchemaToOpenApi(EmailParamsSchema), '.webhook': convertSchemaToOpenApi(WebhookParamsSchema), '.jira': convertSchemaToOpenApi(JiraParamsSchema), @@ -201,7 +207,7 @@ If available, include the link of the conversation at the end of your answer.` To send to the Slack connector, you need the following arguments: - the "id" of the connector - the "params" parameter that you will fill with the message - Both these arguments are required.` + Please include both "id" and "params.message" in the function arguments when executing the Slack connector..` ), }; functionClient.registerAdhocInstruction(slackConnectorInstruction);