---
url: >-
  https://docs.corbitaltech.dev/products/ecommerce-webhook-notifications-for-whatsmarks-saas/contact-creation.md
description: >-
  Automatically create or update CRM contacts from incoming webhook payloads.
  Map order data to contact fields, status, source, groups, and custom fields.
---

# Automatic Contact Save&#x20;

Turn incoming webhook payloads into **CRM contacts automatically**. When a webhook is received, the addon can create a new contact — or update an existing one — using the data sent from your ecommerce platform.

## Introduction

Every order webhook already carries customer details — name, phone, email, and address. Instead of re-entering that data, the addon maps those payload fields onto a CRM contact and saves it for you. Contacts are deduplicated by phone or email, and a failed save never blocks the WhatsApp notification.

## What It Does

| Capability             | Description                                                                 |
| ---------------------- | --------------------------------------------------------------------------- |
| **Creates a contact**  | Builds a new contact from the webhook payload when none exists              |
| **Updates duplicates** | Matches by **phone number or email** so the same customer is not duplicated |
| **Maps any field**     | Uses merge-field syntax to map any payload value to a contact attribute     |
| **Never blocks**       | If contact creation fails, the WhatsApp message is still sent               |

## Step 1: Enable Contact Save

1. Open **Webhooks** and locate the webhook you want to configure
2. Open its **Contact Settings**
3. Toggle **Enable Contact Creation** to **ON**

![Contact Settings toggle on a webhook](./images/woocommerce/contact-settings.png)

## Step 2: Map the Contact Fields

Map each contact field to a value from your payload using the merge syntax `@{merge.field}` (for example `@{data.customer.phone}`).

![Contact field mapping screen](./images/woocommerce/contact-field-mapping.png)

### Required Fields

| Field          | Notes                         |
| -------------- | ----------------------------- |
| **First Name** | Customer first name           |
| **Last Name**  | Customer last name            |
| **Phone**      | Used to match/dedupe contacts |
| **Status**     | CRM contact status            |
| **Source**     | CRM lead/contact source       |

### Optional Fields

| Field             | Notes                                     |
| ----------------- | ----------------------------------------- |
| **Email**         | Also used for duplicate matching          |
| **Company**       | Company name                              |
| **Address**       | Street address                            |
| **City**          | City                                      |
| **Description**   | Free-text note                            |
| **Assignee**      | Staff member the contact is assigned to   |
| **Groups**        | One or more contact groups (multi-select) |
| **Custom Fields** | Map payload values to your custom fields  |

::: tip Merge Field Syntax
Use `@{...}` to pull a value from the payload. The path follows the JSON structure of the data your platform sends — for example `@{billing.first_name}` or `@{data.customer.email}`.
:::

## Step 3: Save

Click **Save** to apply the mapping. The next webhook that arrives on this endpoint will create or update a contact automatically.

## How Duplicates Are Handled

| Scenario                         | Behavior                                     |
| -------------------------------- | -------------------------------------------- |
| No matching contact              | A new contact is **created**                 |
| Contact matched by phone/email   | Existing contact is detected (no duplicate)  |
| Phone value missing in payload   | Contact creation is **skipped**              |
| Contact creation throws an error | Logged; the **WhatsApp message still sends** |

## Best Practices

* Always map **Phone** to the most reliable field in your payload — it is the primary key for deduplication.
* Use **Custom Fields** to capture ecommerce-specific data such as order ID or total.
* Combine with [Template & Media Mapping](./template-mapping.md) so the same payload powers both the notification and the contact record.

## Related

* [Template & Media Mapping](./template-mapping.md) — map the same payload to WhatsApp template variables and media.
* [Webhook Management Dashboard](./webhook-listener.md) — create webhooks and sync sample payloads.
