Issue using custom webhook to write to index in OpenSearch

Hello. I am attempting to use the custom webhook feature for a channel to write an alert back to an index in OpenSearch. Below is the channel that I’ve created.

POST /_plugins/_notifications/configs/
“config_id”: “sample-id5”,
“name”: “sample-name5”,
“config”: {
“name”: “Test5”,
“description”: “This is a test”,
“config_type”: “webhook”,
“is_enabled”: true,
“webhook”: {
“url”: “https://localhost:9200/alert_post/_doc/1”,
“header_params”: {
“Authorization”: “Basic YWRtaW46YWRtaW4=”,
“Content-Type”: “application/json”
“method”: “POST”

Whenever I try to send a test message, I consistently get the error below. When I construct a curl command with the same parameters I am able to write to the index just fine.

curl -POST ‘https://localhost:9200/alert_post/_doc/1’ -H ‘Content-Type: application/json’ -H ‘Authorization: Basic YWRtaW46YWRtaW4=’

Can anyone please advise on what I am doing wrong?


[status_exception] {“event_status_list”: [{“config_id”:“sample-id5”,“config_type”:“webhook”,“config_name”:“Test5”,“email_recipient_status”:,“delivery_status”:{“status_code”:“500”,“status_text”:“Failed to send webhook message Failed: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}},"status":400}”}}]}

That’s because in the current implementation of webhook, the backend will only send string http request body to the webhook url, not json format, so OpenSearch rejects the request. I’ll open an issue for this to add some enhancement.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.