Notifications for Google Chat

I would like to use Google Chat for notifications. So I select “Webhook” and specify the google chat endpoint in the url. This however does not work, cause the payload is not as expected by google

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"payload_version\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"notification_configuration_id\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"run_url\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"run_id\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"run_message\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"run_created_at\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"run_created_by\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"workspace_id\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"workspace_name\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"organization_name\" at 'message': Cannot find field.\nInvalid JSON payload received. Unknown name \"notifications\" at 'message': Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"payload_version\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"notification_configuration_id\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"run_url\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"run_id\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"run_message\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"run_created_at\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"run_created_by\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"workspace_id\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"workspace_name\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"organization_name\" at 'message': Cannot find field."
          },
          {
            "field": "message",
            "description": "Invalid JSON payload received. Unknown name \"notifications\" at 'message': Cannot find field."
          }
        ]
      }
    ]
  }

Could somebody got this working? Or are there any ways I could contribute to make that available?

In general unless the destination explicitly advertises native Prometheus Alertmanager webhook support the destination is going to be expecting messages to be in their own specific format, which won’t be directly compatible with Alertmanager.

The way it is expected to work is that Alertmanager is configured to send webhook messages to a service hosted nearby (e.g. a container on the same system/cluster) that accepts the Alertmanager webhook format and then converts it into whatever format/set of requests that are needed by the external system.

This could be something you create yourself, or it could be an existing off-the-shelf service that has already been written. There is a (non-exhaustive) list of such services available at Integrations | Prometheus

From a very quick look I can’t see anything obviously supporting Google Chat, but a better search might find something. Alternatively it is probably relatively simple to write something yourself (we created a Python lambda to convert Alertmanager webhook to Microsoft Teams as the other options available didn’t do what we needed).

1 Like

good idea, will have a look at that