# 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.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-3c3c288df216138dc8608f1a93ea6a55f6dfc409%2Fgoogle-chat-add-space.png?alt=media\&token=785317c3-004a-4ec7-a2af-a80ca6912cb0)
2. Give your space a name (this example uses "ThousandEyes Custom Webhook Test") and click **Create**.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-7a864c7c3b35bb3ff049cf0638cde8b4712d8ac4%2Fgoogle-chat-create-space.png?alt=media\&token=a8100812-8bcc-4f2f-9dad-ae2df79edb36)
3. Use the pull down arrow next to the space and click **Apps & Integrations**.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-89c3a849d946f0e5d2d044f4c71b892f06e77539%2Fgoogle-chat-app-integrations.png?alt=media\&token=6b6b1bbf-175a-46c2-86e8-f92bd74cee72)
4. Click the **Manage webhooks** button to create the webhook.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-649951a3c385e567d4371e6b2e21a022d275a35a%2Fgoogle-chat-manage-webhooks.png?alt=media\&token=8591e10b-7feb-4a7e-b793-18a2ce13b89d)
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>

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-58b5644a4d6e5c59490afdff6b621d50c6d59ed6%2Fgoogle-chat-incoming-webhook.png?alt=media\&token=69378c8b-cf55-44a4-bfde-90ef5223b1a5)
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.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-f6894889191edb95a933d471bfed54bf5a0468ce%2Fgoogle-chat-incoming-webhook2.png?alt=media\&token=d15864d1-b351-4647-959a-4bd57cb6caf7)
7. Click the **X** to close.
8. Log in to your ThousandEyes account and navigate to **Manage > Integrations**.
9. Click **+ New Integration**.

   ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-fa68cc29dbbe523e506c60db61cac98b9bba0074%2Fthousandeyes-new-integration.png?alt=media\&token=fb997dd7-ea1c-47c6-97ce-61100af1bf2e)
10. In the side panel that opens, click **Custom Webhook**.

    ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-09436d754ffeb92a38bbd4d82b381ba882f2e297%2Fthousandeyes-custom-webhook.png?alt=media\&token=f1a19ad9-6cf1-4751-b92e-6126bb218ce1)
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.

  ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-87740c472f1f9125e3d3e171b5871cd06035f5eb%2Fthousandeyes-google-chat-webhook.png?alt=media\&token=ab740a20-42fb-4ff4-a032-b3aa72f85ded)

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

    ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-83f18c5e7cf4cef6692677007416aa75e94784f1%2Fthousandeyes-custom-webhook-200-OK.png?alt=media\&token=3583d9cb-eb66-42ad-9a5a-c7830a2a2846)
13. Verify the Google Chat space received the test message. It should look like the below screenshot.

    ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-f450ec8f5f56f767de14a2d9781dd6731eecde2e%2Fgoogle-chat-test-message.png?alt=media\&token=aefd2067-6656-47a0-a8c5-d8f7565bd8a9)
14. Click **Save**.
15. Apply the webhook to your existing alert rules using the resulting **Manage Alert Rules** side panel.

    ![](https://1112912342-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M4QARF6s57qxMrOHDTZ%2Fuploads%2Fgit-blob-5c08e530e8ddf3b32735ff19d41b15643cd350a5%2Fthousandeyes-manage-alert-rules.png?alt=media\&token=1bb0d629-cf80-42d6-b1b8-27a7808bca31)

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