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

Add variable substitution into webhook url parameters #1453

Open
1 of 3 tasks
oreillymj opened this issue May 28, 2024 · 0 comments
Open
1 of 3 tasks

Add variable substitution into webhook url parameters #1453

oreillymj opened this issue May 28, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@oreillymj
Copy link

Overview

It would be really useful to be able to dynamically put values from an event triggering a webhook into the URL parameters.
For example, it would be nice to expose variables based on JSON path

botkube/kubernetes:
context: *default-plugin-context
enabled: true
config:
namespaces: ns-test
event:
types:
- create
- update
- delete
- error
labels: { "name" : "value" }
updateSetting:
includeDiff: true
fields:
- status.renewalTime
resources:
- type: cert-manager.io/v1/certificates

Then in a webhook url, refer to the values above as follows

webhook:
  enabled: true
  url: "http://echo.cluster.local/param?action=someaction&namespace={config.namespaces.value}&event={config.event.types.value}&label={config.labels.value[0]}&labels={config.label.values}&resource={config.resources.type.value}"

Where multiple items can trigger an event, like create,update then the event which triggered the webhook is available as a value.
Where items like annotations or labels are an array, you can specify the index or pass the entire array as a base64 encoded JSON array.

It would also be nice to refer to fields in the resource, so for example secrets in a certificate can put into the URL

Acceptance Criteria

  • Make sure documentation is up-to-date, create one if needed
  • Add test coverage for happy-path (unit or e2e test)
  • Record raw demo video for the user-facing changes

Reason

It makes the webhook much more useful for passing values into a REST API.

@oreillymj oreillymj added the enhancement New feature or request label May 28, 2024
@brampling brampling self-assigned this May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants