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

# Click data export

> Link-click events with message and user context, delivered to your SFTP.

The click data export delivers link-click events from messages sent through Sotto to your SFTP server. Each row represents a single click, enriched with the associated user and message context.

<Note>
  Sotto configures and runs this export internally on your behalf. To set one up, contact [support@withsotto.com](mailto:support@withsotto.com) with your destination SFTP details, desired file format (CSV or JSON), and schedule.
</Note>

## File format

| Property       | Value                                   |
| -------------- | --------------------------------------- |
| Format         | CSV (comma-separated values)            |
| Encoding       | UTF-8                                   |
| Delimiter      | Comma (`,`)                             |
| Text qualifier | Double quotes (`"`) around field values |
| Header row     | Included as the first row               |
| Date format    | ISO 8601 (`YYYY-MM-DDTHH:MM:SSZ`, UTC)  |
| Null values    | Represented as the string `null`        |

## Columns

Columns are exported in the following order.

### User fields

| Column                | Type    | Description                                       | Example        |
| --------------------- | ------- | ------------------------------------------------- | -------------- |
| `user_id`             | Integer | Sotto user identifier.                            | `24730`        |
| `user_third_party_id` | String  | Your external identifier for the user, or `null`. | `CUST-001`     |
| `phone_number`        | String  | E.164 phone number.                               | `+15551234567` |

### Message fields

| Column                      | Type     | Description                                                    | Example                                                |
| --------------------------- | -------- | -------------------------------------------------------------- | ------------------------------------------------------ |
| `message_log_id`            | Integer  | Sotto message identifier.                                      | `17406`                                                |
| `message_third_party_id`    | String   | External message identifier, or `null`.                        | `null`                                                 |
| `campaign_id`               | Integer  | Identifier of the campaign the message belongs to, or `null`.  | `8821`                                                 |
| `message_body`              | String   | Full text of the SMS, including any shortened links.           | `Check out your cart https://example.bgco.ai/a4glEZao` |
| `message_date_delivered`    | DateTime | When the message was confirmed delivered to the carrier (UTC). | `2025-09-18T15:08:31Z`                                 |
| `message_date_sent`         | DateTime | When the message was sent from Sotto (UTC).                    | `2025-09-18T15:08:27Z`                                 |
| `message_date_last_updated` | DateTime | When the message record was last modified (UTC).               | `2025-09-18T15:08:30Z`                                 |

### Click fields

| Column                    | Type         | Description                                    | Example                                                    |
| ------------------------- | ------------ | ---------------------------------------------- | ---------------------------------------------------------- |
| `link`                    | String (URL) | Destination URL the user was redirected to.    | `https://example.myshopify.com/cart/c/abc123`              |
| `click_time`              | DateTime     | When the click occurred (UTC).                 | `2025-09-18T15:08:46Z`                                     |
| `user_agent`              | String       | HTTP `User-Agent` from the click request.      | `Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X)` |
| `click_date_last_updated` | DateTime     | When the click record was last modified (UTC). | `2025-09-18T15:08:46Z`                                     |
| `click_date_created`      | DateTime     | When the click record was created (UTC).       | `2025-09-18T15:08:46Z`                                     |

## Multiple rows per message

A single message can produce multiple click rows — for example, when a user clicks the same link more than once, or when a link-preview bot (Facebook, Twitter, etc.) fetches the URL in addition to the user. Each click is a separate row with its own `click_time`, `user_agent`, and timestamps.

<Tip>
  To filter out bot traffic, inspect the `user_agent` field for known bot identifiers such as `facebookexternalhit` or `Twitterbot`.
</Tip>

## Example

```text theme={"dark"}
user_id,user_third_party_id,phone_number,message_log_id,message_third_party_id,campaign_id,message_body,message_date_delivered,message_date_sent,message_date_last_updated,link,click_time,user_agent,click_date_last_updated,click_date_created
"24730","CUST-001","+15551234567","17406","null","8821","Check out your cart https://example.bgco.ai/a4glEZao","2025-09-18T15:08:31Z","2025-09-18T15:08:27Z","2025-09-18T15:08:30Z","https://example.myshopify.com/cart/c/abc123","2025-09-18T15:08:46Z","Mozilla/5.0 (iPhone; CPU iPhone OS 18_6_2 like Mac OS X) AppleWebKit/605.1.15","2025-09-18T15:08:46Z","2025-09-18T15:08:46Z"
```

## Data notes

* **Timestamps** are ISO 8601 in UTC (`YYYY-MM-DDTHH:MM:SSZ`). Convert to your local timezone during processing as needed.
* **Null values** are the literal string `null`, most commonly for `user_third_party_id`, `message_third_party_id`, and `campaign_id` when not set.
* **User agents** are raw browser strings; use a parsing library to extract device, OS, and browser details.
* **Link URLs** are the full destination after redirect and may include query parameters such as cart tokens; they can be long.
