ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14.12k stars 3.44k forks source link

Notification webhook test feature sending its own format #8798

Open haught opened 3 years ago

haught commented 3 years ago
ISSUE TYPE
SUMMARY

The "Test Notification" feature does not have an option to send a formatted test message, it simply sends its own formatted request. The problem when using a webhook is that the formatting can determine if the request is rejected by the service, and as such renders the "Test Notification" useless. When setting up a webhook, it is impossible to actually test a notification.

ENVIRONMENT
STEPS TO REPRODUCE

Add a new notification using type webhook. I am using Google Chat that simply needs a TARGET URL and Content-Type set. Clicking the "Test Notification" bell will send a statically formatted request that is not customizable.

EXPECTED RESULTS

A properly formatted test message body. The format could be specified in CUSTOMIZE MESSAGES... or simply use one of the already customized messages. in my example I need something sent in the format: {"text": "Ansible Tower Test Notification 4 https://awx.example.com"}

ACTUAL RESULTS

{"body": "Ansible Tower Test Notification 4 https://awx.example.com"}

ADDITIONAL INFORMATION
hjkatz commented 3 years ago

We are also wanting this feature. Being able to test with a specific format will help immensely with custom Webhook type Notifications (for services that expect a specific json format for example).

jmhbnz commented 3 years ago

Microsoft Teams also rejects the default webhook notification test payload with a 400 error so it would be great if the test notification function could perhaps attempt to send one or all of the custom message payloads defined.

azrdev commented 2 years ago

I'd suggest to simply use the notification template for successful jobs for testing purposes.