> ## Documentation Index
> Fetch the complete documentation index at: https://onlytraffic.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Callbacks

> Configure callbacks (postbacks) for RevShare on OnlyTraffic: events, macros, and tracker integration.

Callbacks (postbacks) let you receive real-time notifications about events: new subscribers, transactions, and Smart Link clicks. Data is sent to your URL with populated macros.

## Available Events

| Event             | When It Fires                                         |
| ----------------- | ----------------------------------------------------- |
| `new_subscriber`  | A new fan subscribed through your link                |
| `new_transaction` | A fan made a purchase (PPV, tips, subscription, etc.) |
| `smartlink_click` | Click on a Smart Link (Smart Links only)              |
| `marketing_stop`  | Campaign stopped                                      |

## Configuration

Callbacks can be configured at three levels:

1. **Default** — in account settings. Applied to all new campaigns.
2. **Per campaign** — individual settings for a specific campaign.
3. **Per Smart Link** — configured when creating a Smart Link.

Each event can be configured separately:

* **URL** with macros
* **HTTP method** — GET or POST
* **Request body** (POST only) with macros
* **Headers** — custom HTTP headers

## Macros

### Subscriber (`new_subscriber`)

| Macro                           | Description                             |
| ------------------------------- | --------------------------------------- |
| `{{event}}`                     | `new_subscriber`                        |
| `{{campaign.id}}`               | Campaign ID                             |
| `{{campaign.name}}`             | Campaign name                           |
| `{{subscriber.id}}`             | Subscriber's OnlyFans ID                |
| `{{subscriber.name}}`           | Subscriber name                         |
| `{{subscriber.revenue}}`        | Your total revenue from this subscriber |
| `{{subscriber.date_subscribe}}` | Subscription date (UNIX)                |
| `{{subscriber.click_id}}`       | External click\_id (Smart Links)        |

### Transaction (`new_transaction`)

| Macro                     | Description                                                                |
| ------------------------- | -------------------------------------------------------------------------- |
| `{{event}}`               | `new_transaction`                                                          |
| `{{transaction.id}}`      | Transaction ID                                                             |
| `{{transaction.type}}`    | Type: `tip`, `message`, `post`, `subscription`, `resubscription`, `stream` |
| `{{transaction.amount}}`  | Transaction amount                                                         |
| `{{transaction.revenue}}` | Your share                                                                 |
| `{{transaction.date}}`    | Transaction date (UNIX)                                                    |
| `{{subscriber.click_id}}` | External click\_id (Smart Links)                                           |

### Smart Link Click (`smartlink_click`)

| Macro                         | Description                                  |
| ----------------------------- | -------------------------------------------- |
| `{{event}}`                   | `smartlink_click`                            |
| `{{click.click_id}}`          | Internal click ID                            |
| `{{click.external_click_id}}` | Your click\_id from the URL                  |
| `{{click.url}}`               | Redirect URL                                 |
| `{{click.expires_ts}}`        | Expiration time (UNIX)                       |
| `{{click_params.*}}`          | Any parameters from `params[key]` in the URL |

### Campaign Stop (`marketing_stop`)

| Macro                      | Description          |
| -------------------------- | -------------------- |
| `{{event}}`                | `marketing_stop`     |
| `{{campaign.id}}`          | Campaign ID          |
| `{{campaign.name}}`        | Campaign name        |
| `{{campaign.date_create}}` | Creation date (UNIX) |
| `{{campaign.date_finish}}` | Stop date (UNIX)     |

## Examples

**GET request for a tracker:**

```
https://tracker.example.com/postback?event={{event}}&click_id={{subscriber.click_id}}&revenue={{transaction.revenue}}&type={{transaction.type}}
```

**POST request with JSON:**

URL: `https://api.example.com/webhook`

Body:

```json theme={null}
{
  "event": "{{event}}",
  "click_id": "{{subscriber.click_id}}",
  "revenue": "{{transaction.revenue}}",
  "subscriber": "{{subscriber.name}}"
}
```

## Testing

The callback settings interface has a **Test** button — it sends a test request with populated macros so you can verify your integration before going live.

## Request Processing

* Requests are sent with User-Agent: `OnlyTraffic-postback`
* Timeout: 20 seconds
* On connection errors (timeout, refused, SSL) — up to 3 retries
* Log of all sent callbacks is available in the **Postbacks** section
