Skip to content

[Feature][Webhook] Allow closing incidents via request body (fixes #8910)#8921

Open
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8910
Open

[Feature][Webhook] Allow closing incidents via request body (fixes #8910)#8921
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8910

Conversation

@bujjibabukatta

Copy link
Copy Markdown
Contributor

Summary

Fixes #8910

Kibana v8.x webhook connectors require a fixed URL per connector and
cannot dynamically construct URLs using alert context values. This made
it impossible to implement a "create + close" incident workflow in Kibana
because the existing close endpoint requires issueKey in the URL path.

Changes

Added two new endpoints that accept issueKey in the JSON request body
instead of the URL path, while keeping all existing endpoints untouched
for full backward compatibility.

New endpoints

Endpoint Handler issueKey source
POST /connections/:connectionId/issue/close CloseIssueByBody JSON body
POST /connections/by-name/:connectionName/issue/close CloseIssueByBodyByName JSON body

Files changed

  • backend/plugins/webhook/api/issues.go — added CloseIssueByBodyRequest struct, CloseIssueByBody and CloseIssueByBodyByName handlers
  • backend/plugins/webhook/impl/impl.go — registered 3 new routes (including legacy prefix variant)

How it works

Both new handlers decode issueKey from the request body and inject it
into input.Params["issueKey"] before delegating to the existing shared
closeIssue() helper — zero business logic duplicated.

Usage (Kibana or any fixed-URL client)

# Before (broken in Kibana — issueKey in URL, can't be dynamic)
POST /plugins/webhook/connections/1/issue/DLK-1234/close

# After (works in Kibana — fixed URL, issueKey in body)
POST /plugins/webhook/connections/1/issue/close
Content-Type: application/json

{
  "issueKey": "DLK-1234",
  "resolutionDate": "2026-06-13T10:00:00Z"
}

Notes

  • No breaking changes — all existing path-based endpoints remain untouched
  • Route conflict is not an issue: Gin gives static segment /issue/close
    priority over wildcard /issue/:issueKey/close
  • Swagger docs regenerated via make swag

Type of change

  • New feature (non-breaking)

@bujjibabukatta

Copy link
Copy Markdown
Contributor Author

Hi @klesh could you please review and approve the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Webhooks] Move dinamic webhook url fields to body

1 participant