---
url: >-
  https://docs.corbitaltech.dev/products/ecommerce-webhook-notifications-for-whatsmarks-saas/template-mapping.md
description: >-
  Map webhook payload data to WhatsApp template variables, dynamic button
  parameters, and header media (image, video, document) via file upload or URL.
---

# Template & Media Mapping

Map your webhook payload to a WhatsApp template so every notification is filled with real order data. This screen also configures **dynamic buttons** and **header media**.

## Introduction

A WhatsApp template is a fixed layout with variable slots. Template mapping connects each of those slots — header, body, footer, buttons, and media — to a value from your webhook payload, so every customer receives a message personalized with their own order details.

Open the mapping screen from a webhook via **Map Template**.

![Template mapping screen](./images/woocommerce/template-mapping.png)

## Mapping Template Variables

Templates can include variables in the **header**, **body**, and **footer**. Map each variable to a value from the payload using the merge syntax `@{merge.field}` (for example `@{order.number}`).

![Template variable mapping](./images/woocommerce/template-variables.png)

::: tip Auto-generated Merge Fields
After you **sync a sample payload** on the webhook, the addon automatically generates a list of available merge fields from the JSON structure, so you can pick them instead of typing paths by hand.
:::

## Dynamic Button Parameters&#x20;

Templates with **URL buttons** can pull their values from the payload. Map the button parameter to a merge field such as `@{order.tracking_url}`, and each customer receives a button pointing to their own order — for example a live tracking or order-status link.

![Dynamic button url](./images/woocommerce/dynamic-button.png)

## Header Media (Image, Video, Document)&#x20;

For templates with a media header, you can provide the media in **three ways**:

| Method                  | When to Use                                                                  |
| ----------------------- | ---------------------------------------------------------------------------- |
| **File Upload**         | A fixed media file that is the same for every message                        |
| **Direct URL**          | A hosted media file (same for every message)                                 |
| **Payload Merge Field** | Dynamic media per customer, e.g. `@{invoice_url}` resolved from each payload |

![Header media configuration](./images/woocommerce/header-media.png)

### Supported Media Types

| Media Type   | Example Use                         |
| ------------ | ----------------------------------- |
| **Image**    | Product photo for the ordered item  |
| **Video**    | Promo or onboarding clip            |
| **Document** | Order invoice or shipping label PDF |

::: tip Dynamic Media Example
Map the header media to `@{data.invoice.pdf_url}` to send each customer their own invoice PDF, or `@{product.image}` to send the product image for their order.
:::

::: warning URL Requirements
Media URLs must be **publicly accessible over HTTPS** and point directly to a supported file. Respect WhatsApp's media type and size limits for the template format.
:::

## Related

* [Automatic Contact Save](./contact-creation.md) — use the same payload to create CRM contacts.
* [Webhook Management Dashboard](./webhook-listener.md) — create webhooks and sync sample payloads.
