# Clay (https://webmetic.de/docs/en/integrationen/clay)

Webmetic sends every company that visits your website for the first time to a webhook in Clay. In Clay you enrich and qualify the company, for example a machine builder after its first visit to your pricing page. At the end you'll have:

- a Clay table with one row for every new company
- in each row the company's data and its first visit
- columns for the fields you work with in Clay

![A Clay table with name, city, website, and Lead Score of six companies from Webmetic](https://webmetic.de/docs/media/en/light/clay-webhook-tabelle.webp)

1. **Visit**: A company visits your website for the first time.
2. **Webhook**: Webmetic sends the company to the URL of your Clay table.
3. **Row**: Clay creates one row for each delivery.
4. **Keep working**: You enrich and qualify the rows in Clay.

## Before you start [#before-you-start]

- **Time**: Setup takes about 10 minutes.
- **Account**: You need a Webmetic account with at least one website.
- **Access**: You need a Clay workspace. In Clay, webhooks are only available on paid plans and during Clay's trial.
- **Rights**: Only admins see the **Integrations** menu item. If a partner manages your account, the partner decides whether it appears.
- **Plan**: Webhooks are available on every plan. On the Free plan, Webmetic only sends the companies you see by name and leaves out the others entirely. For details, see [Plans](https://webmetic.de/docs/en/konto/plaene).
- **Cost**: The integration costs no credits.

## 1. Create a webhook in Clay [#1-create-a-webhook-in-clay]

Clay gives you a URL and a token, which you enter in Webmetic in step 2.

1. In a Clay workbook, click **Add** at the bottom. The **Create** panel opens, or opens by itself in a new workbook.
2. In the **Create** panel, click **All sources**.
3. Search for `webhook` and choose **Webhook**. Clay creates the table **Pull in data from a Webhook Table** and opens the **Pull in data from a Webhook** panel.
4. Under **Webhook URL**, copy the URL with **Copy** and keep it at hand.
5. Click **Add auth token**. Clay asks for confirmation in the **Create auth token?** window.
6. Click **Create**. Clay shows you the token this one time only.
7. Copy the token and keep it next to the URL, because you need both in step 2.
8. Under **Send response as**, leave **Plain text** selected.

In the panel, Clay tells you the header name for the token: `x-clay-webhook-auth`.

![The Pull in data from a Webhook panel with the webhook URL, the header name for the token, and Send response as](https://webmetic.de/docs/media/en/light/clay-webhook-quelle.webp)

## 2. Create a webhook in Webmetic [#2-create-a-webhook-in-webmetic]

1. Open [**Menu** > **Integrations** > **Webhooks**](https://app.webmetic.de/?menu=webhooks). The **Webhooks** window opens.
2. Click **New webhook**.
3. Under **URL**, paste the URL you copied from Clay.
4. Optional: Under **Name**, enter a name, for example `Clay`.
5. Under **Event**, leave **New company** selected. With any other event, Webmetic can send the same company again, and the Clay table only accepts a limited number of entries.
6. Under **Websites**, choose the websites whose companies you want to send to Clay. At first, all of them are selected.
7. Click **Advanced** to show the **Additional headers** section.
8. Click **Add header**.
9. In the header row, enter `x-clay-webhook-auth` in the **Name** field and the token from Clay in the **Value** field.
10. Click **Create webhook**. The **Secret (optional)** window opens, but Clay doesn't need the secret.
11. Click **Got it** to close the window.

For every field of a new webhook, see [Create a webhook](https://webmetic.de/docs/en/api/webhooks#create-a-webhook).

## 3. Test and create columns [#3-test-and-create-columns]

With a test row, you create the columns before real companies arrive.

1. In the **Webhooks** window, click **Test** on your webhook. Webmetic sends the invented company Beispiel GmbH and shows the message "Test delivered" with status 200.
2. In Clay, click the cell in the **Webhook** column of the new row. The **Cell details** panel opens.
3. Expand **Data** and then **Company** to see the company's fields.
4. Point at a field, for example **Postal Code**, and click **Add to column**.
5. Click **Create column**, or choose an existing column under **Map to an existing column**.

![Cell details of the test row with Add to column for the Postal Code field](https://webmetic.de/docs/media/en/light/clay-webhook-spalte.webp)

Repeat steps 4 and 5 for every field you need. Clay fills these columns in new rows by itself. When you're done, delete the test row in Clay, because it holds an invented company.

## What arrives in Clay [#what-arrives-in-clay]

Webmetic sends a new company a few minutes after the visit appears in the dashboard, and Clay creates one row for each delivery.

Under **Data**, you find **Company** with the company data and **Visit** with the visit and its page views. Clay capitalizes the field names, so `company_name` becomes **Company Name**. **Lead Score** is the [activity](https://webmetic.de/docs/en/visitor-intelligence/relevanz-aktivitaet-und-fit).

If Webmetic doesn't know a value, the field is missing. For every field, see [Data format](https://webmetic.de/docs/en/api/webhooks#data-format). No data flows back from Clay into Webmetic.

## Limits [#limits]

- A webhook sends companies that visit your website for the first time after you set it up. If your website already has or had a webhook, companies from the 48 hours before can be included too, if Webmetic only finished processing their visit afterwards. You fetch earlier companies through the [API](https://webmetic.de/docs/en/api). That also needs a paid plan in Clay.
- According to Clay, a webhook table in Clay accepts at most 50,000 entries, even if you delete rows.
- You can't change the URL of a webhook. For a new Clay table, create a new webhook in Webmetic.

## Troubleshooting [#troubleshooting]

### Why don't any rows arrive in Clay? [#why-dont-any-rows-arrive-in-clay]

The usual cause is a token or header name that doesn't match. You see which status Clay returned in your webhook's **Log**, under **Response**.

1. In the **Webhooks** window, click **Edit** on your webhook.
2. Under **Advanced**, check that the name is exactly `x-clay-webhook-auth`.
3. Enter the token again in the **Value** field and click **Save**.

To send deliveries with the status **Failed** again, click **Resend** in the **Log**.

If the log only shows the test, no new company has visited your website since setup. That isn't an error.

### Why doesn't the test row arrive? [#why-doesnt-the-test-row-arrive]

The message "Test failed" also names the reason. Because a new token can take up to 60 seconds to work according to Clay, wait that long before you test again. If the URL is wrong, create a new webhook.

### Why is the webhook disabled? [#why-is-the-webhook-disabled]

If no delivery reaches Clay for 3 days, Webmetic disables the webhook and emails every admin. To turn it on again, see [Re-enable a webhook](https://webmetic.de/docs/en/api/webhooks#re-enable-a-webhook).

## Next steps [#next-steps]

- [Webhooks](https://webmetic.de/docs/en/api/webhooks): Read up on events, the data format, and the log in detail.
- [API](https://webmetic.de/docs/en/api): Fetch earlier companies and contacts from your own systems.
- [Relevance, activity, and fit](https://webmetic.de/docs/en/visitor-intelligence/relevanz-aktivitaet-und-fit): Understand what Lead Score, Fit Score, and Relevance Score mean in Clay.
