# Generic Webhook

{% hint style="info" %}
This capability is only available to BYOC deployments. Check out our [pricing page](https://www.groundcover.com/pricing) for more information about subscription plans and the available deployment modes.
{% endhint %}

## Configuring Webhook Integration in groundcover

1. In groundcover, Go to **Settings → Connected Apps**.
2. Click on Webhook Integration<br>

   <figure><img src="/files/eH878QUwJSK33ewzWpdN" alt="" width="311"><figcaption></figcaption></figure>
3. Fill in a Webhook name
4. Fill Webhook details
   1. Select an HTTP method: `GET` / `POST` / `PUT` / `DELETE`
   2. Enter your URL
   3. Optional: Add Authentication headers, you can either add `basic auth` user and password, or an `API Key`. (Can't do both)
   4. Optional: Add custom headers, by adding key and value pairs
   5. Optional: Add a custom payload
      1. Note that the payload should be a JSON format, but can be used with Jinja2 formatting in order to render different payloads for different if/else conditions, see example below.

<figure><img src="/files/zhvj3mqysrdrWryLlGy4" alt="" width="375"><figcaption></figcaption></figure>

5. Optional: Test the connection-
   1. This will send a notification similar to the notification that will be send by monitors with `[TEST] Notification from groundcover` in the title to differentiate from 'real' notifications.
6. Save.

### Webhook Custom Payload Examples

#### Concatenating multiple variables into a single string

```
{
  "channel_name": "{{labels.cluster}} - {{labels.workload}}"
}
```

For an issue with '`cluster:prod`' and '`workload:sensor`', the above will be translated into: `"channel_name": "prod - sensor"`

#### Using if/else conditions for custom payloads:

Use jinja2 formatting in order to define the conditions to meet and the content to send

```
{% if labels.env == 'ga' %}
    {
        "title": "{{summary}}",
        "description": "{{description}}",
        "comment": "this is the GA env",
        "env": "{{labels.env}}"
    }
{% elif labels.env == 'beta' %}
    {
        "title": "{{summary}}",
        "description": "{{description}}",
        "comment": "this is the beta env",
        "env": "{{labels.env}}"
    }
{% endif %}
```

Or alternatively just use the conditions for part of the json:

```
{
  "key1":"value",
  "key2":"value",
  {% if labels.x == 'x' %}
    "key3": 'x',
  {% elif labels.y == 'y' %}
    "key3": 'bla',
  {% endif %}
  "key4":"value"
}
```


---

# 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.groundcover.com/integrations/connected-apps/generic-webhook.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.
