---
url: >-
  https://docs.corbitaltech.dev/products/whatsmark-saas/tenant/dynamic-button-url.md
description: >-
  Personalize WhatsApp template Website URL buttons for every recipient
  automatically using contact merge fields. Works in Campaign, Bot Flow,
  Template Bot, Initiate Chat, and Ecommerce.
---

# Dynamic Button URL Variables&#x20;

WhatsApp template **Website URL buttons** support a `{{1}}` placeholder in the link. WhatsMark lets you fill that placeholder with a **static value** or a **merge field** (like `{contact_id}`) so every recipient gets a button pointing to their own page — automatically.

```
Template URL:  https://yoursite.com/invoice/{{1}}
You enter:     {contact_id}
Sent to John (ID 42):   https://yoursite.com/invoice/42
Sent to Sarah (ID 91):  https://yoursite.com/invoice/91
```

## How It Works — End to End

| Step | What happens |
| --- | --- |
| **1. Create template in Meta (or WhatsMark)** | Add a Website URL button and include `{{1}}` in the URL |
| **2. Template syncs to WhatsMark** | WhatsMark detects which buttons have URL placeholders |
| **3. Select the template anywhere** | A **Button URL Variables** input appears automatically |
| **4. Enter a static value or `@` merge field** | Type a fixed value, or pick a contact field from the dropdown |
| **5. WhatsMark resolves and sends** | Each recipient's merge field is replaced with their real data before delivery |

## Part 1 — Create the Template

### Step 1: Add a Website URL Button with `{{1}}`

In Meta WhatsApp Manager (or WhatsMark **Create Template → Step 5: Buttons**), add a **Website URL** button. Place `{{1}}` where the dynamic value should go:

| Pattern | Example |
| --- | --- |
| Path segment | `https://yoursite.com/invoice/{{1}}` |
| Query parameter | `https://yoursite.com/track?id={{1}}` |
| Subdomain | `https://{{1}}.yoursite.com/portal` |

::: warning Only Website URL buttons support `{{1}}`
Quick Reply and Phone Number buttons do not have this capability.
:::

::: tip Create directly in WhatsMark
You can enter `{{1}}` in the Website URL field when creating a template in WhatsMark. The live preview will show the button with the placeholder. → [Create Template](./create-template.md#2-website-url-buttons)
:::

### Step 2: Submit and Wait for Approval

Submit the template to Meta. Once approved, WhatsMark syncs it automatically and the template becomes available in all send flows.

## Part 2 — Filling in the Variable

### Step 3: Select the Template in Any Send Flow

Open any send flow (Campaign, Initiate Chat, Bot Flow, etc.) and choose the template. If any Website URL button contains `{{1}}`, a **Button URL Variables** section appears automatically below the other variable fields.

![Button URL Variables input appearing in a send flow](../images/templates/dynamic-button-url.png)

### Step 4: Enter a Static Value or Use `@` for a Merge Field

The input is labelled with the button name (e.g., *"Track Order — URL variable"*). You have two options:

* **Static value** — Type any fixed text. Example: `ORD-2024-001`. Every recipient gets this same value.
* **Merge field** — Type `@` to open the merge field picker, then select a field (e.g., `{contact_id}`). WhatsMark replaces it with each recipient's real data at send time.

::: tip Combine both
You can mix static text and a merge field. For example, entering `USER-{contact_id}` in a URL like `https://site.com/ref/{{1}}` produces `https://site.com/ref/USER-42` for John (ID 42).
:::

::: warning Required field
WhatsMark will not let you send if the Button URL Variables input is empty — it prevents broken links from reaching customers.
:::

### Step 5: Send — WhatsMark Resolves and Delivers

On send, WhatsMark:

1. Reads the entered value (e.g., `{contact_id}`)
2. Looks up the real value for each contact from the database
3. Passes the resolved value to WhatsApp API as the `{{1}}` parameter
4. WhatsApp builds the final URL and delivers the message with each recipient's unique button link

## Available Merge Fields

Type `@` in the Button URL variable input to see all available fields:

### Contact Fields

| Field name in picker | Key to insert | Resolves to |
| --- | --- | --- |
| Contact First Name | `{contact_first_name}` | Contact's first name |
| Contact Last Name | `{contact_last_name}` | Contact's last name |
| Contact ID | `{contact_id}` | Unique numeric ID in WhatsMark |
| Contact Email | `{contact_email}` | Email address |
| Contact Phone Number | `{contact_phone_number}` | Phone number |
| Contact Company | `{contact_company}` | Company name on the contact record |
| Contact Website | `{contact_website}` | Website URL from the contact record |
| Contact Type | `{contact_type}` | Lead, Customer, or Guest |
| Lead Status | `{lead_status}` | Current status label |
| Lead Source | `{lead_source}` | Where the contact came from |
| Lead Assigned | `{lead_assigned}` | Full name of the assigned staff member |
| Assigned By | `{assigned_by}` | Name of the person who created the contact |

### Company & System Fields

| Field name in picker | Key to insert | Resolves to |
| --- | --- | --- |
| Company Name | `{company_name}` | Your tenant / business name |
| Base URL | `{base_url}` | Your WhatsMark app base URL |
| Dark Logo | `{dark_logo}` | URL of the dark-theme logo image |
| Light Logo | `{light_logo}` | URL of the light-theme logo image |

::: warning URL-safe values
Use fields like Contact ID, Contact Phone Number, or Company Name — these are safe in URLs. Contact Email contains `@` and `.` — if using it in a URL, ensure your server handles URL encoding correctly, or prefer ID-based fields.
:::

## Where This Feature Is Available

| Area | How to use |
| --- | --- |
| **Initiate Chat** | Button URL Variables input appears in the template send modal |
| **Contact Initiate Chat** | Same input when sending a template directly from the Contacts page |
| **Bot Flow** | Configure once in the Template Message node — resolved per contact at runtime |
| **Template Bot** | Set the variable once in the bot setup — applied when the bot triggers for any contact |
| **Bulk Campaign** | Use merge fields so each of the hundreds of recipients gets their own unique link |
| **CSV Campaign** | Same as Bulk Campaign — the variable applies to each row |
| **Ecommerce** | Set the variable in template mapping — links customers to their order/invoice/tracking page |

## Real-World Examples

**Invoice Link**

```
Template URL:  https://billing.yoursite.com/invoice/{{1}}
Variable:      {contact_id}
Result (ID 42): https://billing.yoursite.com/invoice/42
```

**Order Tracking**

```
Template URL:  https://track.yoursite.com/?order={{1}}
Variable:      ORD-2024-885   (static per send)
Result:        https://track.yoursite.com/?order=ORD-2024-885
```

**Personal Portal**

```
Template URL:  https://portal.yoursite.com/login?ref={{1}}
Variable:      {contact_phone_number}
Result:        https://portal.yoursite.com/login?ref=+15550100
```

**Appointment Booking**

```
Template URL:  https://book.yoursite.com/{{1}}
Variable:      {lead_assigned}
Result:        https://book.yoursite.com/Jane Smith
```

## Tips & Best Practices

* **Use Contact ID for unique links.** `{contact_id}` is always unique and numeric — the safest choice for URL path segments with no encoding issues.
* **Type `@` to search merge fields.** Start typing a keyword like "contact" or "name" to filter the list quickly.
* **Test before bulk sending.** Use Initiate Chat with a test contact to verify the final URL is correct before running a full campaign.
* **One input per URL button.** If your template has two Website URL buttons each with `{{1}}`, you will see two separate input fields — one per button.
* **The field is always required.** WhatsMark will not let you send if it is empty — broken button links never reach customers.
* **URL-encode special characters.** Fields like Contact Email contain characters that need encoding in URLs — prefer ID-based fields when in doubt.
