You can create a workflow that sends messages to a Google Chat *incoming webhook*.
Incoming webhooks let you send asynchronous messages into Google Chat from
applications that aren't Chat apps. For example, you can configure a monitoring
application to notify on-call personnel on Google Chat when a server goes down.

## Create and register a Google Chat incoming webhook

In the Google Chat space where you want to receive messages, create a webhook.
Follow the instructions to
[register the incoming webhook](https://developers.google.com/chat/how-tos/webhooks#step_1_register_the_incoming_webhook).

## Make an HTTP call to the webhook URL

[Create a workflow](https://docs.cloud.google.com/workflows/docs/creating-updating-workflow.md.txt#create_a_workflow)
and add a step to the workflow that makes an `HTTP POST` call to the webhook URL.
For example:

<br />

### YAML

```yaml
  - get_message:
      call: http.post
      args:
        url: WEBHOOK_URL
        body:
          text: "Hello world!"
        headers:
          Content-Type: "application/json; charset=UTF-8"
      result: response
  - return_value:
      return: ${response}
```

### JSON

```json
  [
    {
      "get_message": {
        "call": "http.post",
        "args": {
          "url": "WEBHOOK_URL",
          "body": {
            "text": "Hello world!"
          },
          "headers": {
            "Content-Type": "application/json; charset=UTF-8"
          }
        },
        "result": "response"
      }
    },
    {
      "return_value": {
        "return": "${response}"
      }
    }
  ]
```

<br />

Replace `WEBHOOK_URL` with the webhook URL that you copied
when registering the incoming webhook.

You can confirm that the workflow works as expected by ensuring that a
notification is sent to your Google Chat space.

## What's next

- [Learn more about making HTTP requests](https://docs.cloud.google.com/workflows/docs/http-requests.md.txt)
- [Learn more about Workflows](https://docs.cloud.google.com/workflows/docs/overview.md.txt)