[š Bug]: WebHook provider cannot POST a JSON message with a key named "key".
Describe the bug
In the definition of a step in a workflow, if you create a parameter with the key "key", for example a POST in a WebHook:
steps:
- name: webhook
provider:
type: webhook
config: "{{ config }}"
with:
url: https://test/test
method: POST
body:
key: ALERT
host: "{{alert.service}}"
time: "{{alert.lastReceived}}"
source: "{{alert.source}}"
message: "{{alert.description}}"
The data of the POST body will be: "ALERT" and not a JSON with the keys: key, host, time, source and message.
This is because in parse_provider_parameters:
https://github.com/keephq/keep/blob/cfcf49090d12280202713a0ff477a8abe51382ec/keep/parser/parser.py#L464-L486
if the parameter is a dictionary it attempt to converted it to a StepProviderParameter and this works if the dict has a key with the name "key" because in the definition of de pydantic model "key" is the only required parameter
https://github.com/keephq/keep/blob/cfcf49090d12280202713a0ff477a8abe51382ec/keep/step/step_provider_parameter.py#L1-L7
Hi @manuelluis! I'm Dosu and Iām helping the keep team.
This bug happens because the parsing logic in parse_provider_parameters tries to convert any dictionary with a key field into a StepProviderParameter object. The StepProviderParameter Pydantic model only requires the key field, so any other fields in your dictionary (like host, time, etc.) are ignored and lost. As a result, the POST body is flattened to just the value of key (e.g., "ALERT") instead of the full JSON object you intended. This is a side effect of how the code generically maps dicts with a key field to this model, and similar issues could occur elsewhere if other models use a single required field and naive dict unpacking. Thereās currently no documented workaroundāavoid using key as a top-level field in webhook POST bodies until the parsing logic is improved.
See the relevant code and model definitions here.
StepProviderParameter model reference.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report š | OtherĀ Ā Ā
Ā