61 lines
1.0 KiB
Plaintext
61 lines
1.0 KiB
Plaintext
---
|
|
title: Contacts
|
|
description: Store and manage your audience
|
|
icon: Users
|
|
---
|
|
|
|
## Structure
|
|
|
|
```json
|
|
{
|
|
"id": "contact_abc123",
|
|
"email": "user@example.com",
|
|
"subscribed": true,
|
|
"data": {
|
|
"firstName": "Sarah",
|
|
"plan": "pro",
|
|
"mrr": 99
|
|
}
|
|
}
|
|
```
|
|
|
|
## Adding contacts
|
|
|
|
- **Dashboard:** Contacts → Add Contact
|
|
- **CSV import:** Contacts → Import
|
|
- **API:** `POST /contacts`
|
|
- **Events:** Auto-created when tracking events
|
|
|
|
## Contact data
|
|
|
|
The `data` field stores custom key-value pairs.
|
|
|
|
**Best practices:**
|
|
- Use consistent naming (camelCase or snake_case)
|
|
- Store dates as ISO strings: `"2024-03-15T10:30:00Z"`
|
|
- Use numbers for numeric values (enables comparisons)
|
|
|
|
## Template variables
|
|
|
|
Use `{{fieldName}}` in emails:
|
|
|
|
```html
|
|
<p>Hello {{firstName}}!</p>
|
|
```
|
|
|
|
**Fallback:** `{{firstName ?? 'there'}}`
|
|
|
|
**Reserved:** `{{email}}`, `{{id}}`
|
|
|
|
## Temporary data
|
|
|
|
Data that won't save to contact:
|
|
|
|
```javascript
|
|
data: {
|
|
resetCode: { value: 'ABC123', persistent: false }
|
|
}
|
|
```
|
|
|
|
Use for: one-time codes, tokens, session data.
|