# Google Chat for Alert Notifications

The following steps will configure a ThousandEyes custom webhook to send alert notifications to a Google Chat space.

1. Open Google Chat and select an existing space or, to create a new space under the **Spaces** section, click the **+** and **Create a Space** as shown in the screenshot below.

   If you already have a Google Chat space you want to use to create the webhook, you can skip to step 3 - the **Apps & Integrations** step.

   ![](/files/XwjBPzeiC7sSOSe7aajt)
2. Give your space a name (this example uses "ThousandEyes Custom Webhook Test") and click **Create**.

   ![](/files/PzSjf8zdFa6gpTXO7db2)
3. Use the pull down arrow next to the space and click **Apps & Integrations**.

   ![](/files/8D5XEVvBbOrE0YkVpinG)
4. Click the **Manage webhooks** button to create the webhook.

   ![](/files/OpHHvgBl8oHa7yIZFZNP)
5. Provide a name for the incoming webhook (this example is named ThousandEyes Webhook) and optionally add an avatar (for example, the ThousandEyes logo), then click **Save.**

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>The optional ThousandEyes logo avatar can be found at: <a href="https://avatars.githubusercontent.com/u/307302?s=200&#x26;v=4">https://avatars.githubusercontent.com/u/307302?s=200&#x26;v=4</a></p></div>

   ![](/files/JuRORxu0W4wD2kVCbJwq)
6. **Important:** Copy the resulting webhook URL which includes the key and token information. This will be required for **step 11** for ThousandEyes to send alert notifications into the Google Chat space.

   ![](/files/mjIkGnqIAOKCerJuw9lU)
7. Click the **X** to close.
8. Log in to your ThousandEyes account and navigate to **Manage > Integrations**.
9. Click **+ New Integration**.

   ![](/files/kX774udHoIHyRS2NGhqa)
10. In the side panel that opens, click **Custom Webhook**.

    ![](/files/mfBrRfFKjNZX46FlJknJ)
11. Fill in the following fields:

* **Name**: This is the name that will be assigned to the [alert notification](https://docs.thousandeyes.com/product-documentation/alerts/standard-notification-methods/classic-webhooks-for-alert-notifs#configuring-webhook-notifications).
* **URL**: The URL of the Google Chat webhook (the URL you copied in step 6) where the alerts will be sent.

{% hint style="info" %}
You can break the key and token out in JSON format and add them to the URL query parameters section instead of using the long URL.
{% endhint %}

* **Body**: The instructions for the webhook. **Note**: The code below is an example only. You can update it to meet your requirements.

  ```json
  {
        {{#unless alert.timeCleared }}
        "cards": [
        {
           "header": {
              "title": "Thousand Eyes Alert",
              "subtitle": "{{alert.rule.name}}",
           "imageUrl":"https://avatars.githubusercontent.com/u/307302?s=200&v=4"
           },
           "sections": [
           {
              "widgets": [
              {
                    "keyValue": {
                       "topLabel":"{{#each alert.details}}
                                      {{metricsAtStart}}{{#unless @last}}, {{/unless}}
                                      {{/each}}" ,
                       "content": "<h1>{{alert.test.name}}</h1>",
                       "contentMultiline": "false",
                       "bottomLabel":"Severity Level: {{alert.severity.display}}",
                       "icon": "EMAIL"
                    }
              }]
           },
           {
              "widgets": [
              {
                    "buttons": [
                    {
                       "textButton": {
                          "text": "Show This Test",
                          "onClick": {
                                "openLink": {
                                   "url": "https://app.thousandeyes.com/network-app-synthetics/views/?testId={{alert.test.id}}"
                                }
                          }
                       }
                    },
                    {
                       "textButton": {
                          "text": "Show All Active Alerts",
                          "onClick": {
                                "openLink": {
                                   "url": "https://app.thousandeyes.com/alerts/list/active"
                                }
                          }
                       }
                    }]
              }]
           }]
        }],
        {{/unless}}
  }
  ```

  A completed webhook page should look like the below screenshot.

  ![](/files/jj2kjWnDdJvrIyAak3Eg)

12. Click **Test** to verify that the webhook is working. You will receive the message shown below with **OK (200)** if it is working.

    ![](/files/jFbI3JlyB7enTXslAyPU)
13. Verify the Google Chat space received the test message. It should look like the below screenshot.

    ![](/files/iXDWQzWQ6NodDXS0llM3)
14. Click **Save**.
15. Apply the webhook to your existing alert rules using the resulting **Manage Alert Rules** side panel.

    ![](/files/RHmymHCNmE7cxOiXBf0O)

For more information on configuring webhooks, see [Custom Webhooks](https://docs.thousandeyes.com/product-documentation/integration-guides/custom-webhooks).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thousandeyes.com/product-documentation/integration-guides/custom-webhook-examples/google-chat-for-alert-notifs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
