opensearch-project / notifications

Notifications plugin for OpenSearch enables other plugins to send notifications via Email, Slack, Amazon Chime, Custom web-hook etc channels
Apache License 2.0
25 stars 65 forks source link

[FEATURE] Enhance custom webhooks to support custom message formats for request bodies #818

Open AWSHurneyt opened 10 months ago

AWSHurneyt commented 10 months ago

Is your feature request related to a problem? Currently, custom webhook channels directly use the message string as the request body when sending a notification. However, some webhooks require other formats for the request body. E.g., Google chat require a { text: "message content" } format (documentation link) similar to Slack webhooks.

What solution would you like? Custom webhooks should be able to support custom message formats to accommodate more webhook types.

fbarbeira commented 7 months ago

Mattermost is also affected with this issue:

[2024-02-26T08:12:41,734][ERROR][o.o.n.c.t.WebhookDestinationTransport] [os-manager] Exception sending webhook message b8pC5I0BK_x004ISOKmL: org.opensearch.notifications.spi.model.MessageContent@5f7e7f1
java.io.IOException: Failed: {"id":"model.incoming_hook.parse_data.app_error","message":"Unable to parse incoming data.","detailed_error":"invalid character 'T' looking for beginning of value","request_id":"yr5iwditu3rnurdh8yrjp3no3o","status_code":400}