Issue
When setting up a generic webhook for notifications with the Google chat API the following error is seen when saving.
"Unable to connect" and a possible 400 http error is returned. (check dev tools network tab in your browser)
Cause
This is issue could be due to an actual connection issue or the GoogleAPI rejecting some of the fields sent.
"message": "Invalid JSON payload received. Unknown name \"applicationChild\" at 'message':
If you setup the generic webhook with no payload, we send everything. When that happens gchat can fail with a 400.
Resolution
First test with curl on your webhook to ensure connectivity.
curl --location --request POST '%webhook URL here' --header 'Content-Type: application/json' --data-raw '{"text": "Test notification"}'
If that connects fine we need to make sure we supply what gchat accepts for fields.
The below link shows the acceptable fields for GoogleChat API:
https://developers.google.com/hangouts/chat/reference/rest/v1/spaces.messages#Message
As an example you could configure something like the following:
{
'text': '$EventType, $Message, $ApplicationContextPath, $Severity'
}