@cakemail-org/cakemail-cli 1.5.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +12 -0
- package/.env.example +40 -0
- package/.env.test.example +45 -0
- package/CHANGELOG.md +1031 -0
- package/README.md +319 -15
- package/audit-formats.js +128 -0
- package/cakemail.rb +20 -0
- package/dist/cli.js +27 -10
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -6
- package/dist/client.js.map +1 -1
- package/dist/commands/account.js +1 -1
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/attributes.js +1 -1
- package/dist/commands/attributes.js.map +1 -1
- package/dist/commands/campaigns.d.ts.map +1 -1
- package/dist/commands/campaigns.js +103 -8
- package/dist/commands/campaigns.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +63 -4
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/contacts.d.ts.map +1 -1
- package/dist/commands/contacts.js +91 -12
- package/dist/commands/contacts.js.map +1 -1
- package/dist/commands/emails.js +1 -1
- package/dist/commands/emails.js.map +1 -1
- package/dist/commands/interests.d.ts +5 -0
- package/dist/commands/interests.d.ts.map +1 -0
- package/dist/commands/interests.js +172 -0
- package/dist/commands/interests.js.map +1 -0
- package/dist/commands/lists.d.ts.map +1 -1
- package/dist/commands/lists.js +6 -8
- package/dist/commands/lists.js.map +1 -1
- package/dist/commands/logs.d.ts +5 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +237 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/reports.js +1 -1
- package/dist/commands/reports.js.map +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/segments.js.map +1 -1
- package/dist/commands/senders.d.ts.map +1 -1
- package/dist/commands/senders.js +11 -8
- package/dist/commands/senders.js.map +1 -1
- package/dist/commands/suppressed.js +1 -1
- package/dist/commands/suppressed.js.map +1 -1
- package/dist/commands/tags.d.ts +5 -0
- package/dist/commands/tags.d.ts.map +1 -0
- package/dist/commands/tags.js +124 -0
- package/dist/commands/tags.js.map +1 -0
- package/dist/commands/templates.js +1 -1
- package/dist/commands/templates.js.map +1 -1
- package/dist/commands/transactional-templates.d.ts +5 -0
- package/dist/commands/transactional-templates.d.ts.map +1 -0
- package/dist/commands/transactional-templates.js +354 -0
- package/dist/commands/transactional-templates.js.map +1 -0
- package/dist/commands/webhooks.js +1 -1
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/utils/auth.d.ts +8 -1
- package/dist/utils/auth.d.ts.map +1 -1
- package/dist/utils/auth.js +39 -11
- package/dist/utils/auth.js.map +1 -1
- package/dist/utils/config-file.d.ts +7 -0
- package/dist/utils/config-file.d.ts.map +1 -1
- package/dist/utils/config-file.js +15 -0
- package/dist/utils/config-file.js.map +1 -1
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -4
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/list-defaults.d.ts +33 -0
- package/dist/utils/list-defaults.d.ts.map +1 -0
- package/dist/utils/list-defaults.js +52 -0
- package/dist/utils/list-defaults.js.map +1 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +36 -13
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/progress.d.ts.map +1 -1
- package/dist/utils/progress.js +32 -4
- package/dist/utils/progress.js.map +1 -1
- package/dist/utils/spinner.d.ts +17 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +43 -0
- package/dist/utils/spinner.js.map +1 -0
- package/docs/DOCUMENTATION-STANDARD.md +1068 -0
- package/docs/README.md +161 -0
- package/docs/developer/ARCHITECTURE.md +516 -0
- package/docs/developer/AUTH.md +204 -0
- package/docs/developer/CONTRIBUTING.md +227 -0
- package/docs/developer/DOCUMENTATION_SUMMARY.md +346 -0
- package/docs/developer/PROJECT_INDEX.md +365 -0
- package/docs/planning/API_COVERAGE.md +1045 -0
- package/docs/planning/BACKLOG.md +1159 -0
- package/docs/planning/PROFILE_SYSTEM_TASKS.md +287 -0
- package/docs/planning/UX_IMPLEMENTATION_PLAN.md +691 -0
- package/docs/planning/archive/RELEASE_CHECKLIST_v1.3.0.md +332 -0
- package/docs/planning/archive/RELEASE_v1.3.0.md +428 -0
- package/docs/planning/archive/cakemail-cli-ux-improvements.md +438 -0
- package/docs/planning/cakemail-profile-system-plan.md +1121 -0
- package/docs/testing/AI_USER_SIMULATION_DESIGN.md +1342 -0
- package/docs/testing/KENOGAMI_BIDIRECTIONAL_FLOW.md +1517 -0
- package/docs/testing/KENOGAMI_TRUTH_RECONCILIATION_SYSTEM.md +1369 -0
- package/docs/user-manual/.obsidian/app.json +1 -0
- package/docs/user-manual/.obsidian/appearance.json +1 -0
- package/docs/user-manual/.obsidian/core-plugins.json +33 -0
- package/docs/user-manual/.obsidian/workspace.json +167 -0
- package/docs/user-manual/01-getting-started/01-installation.md +214 -0
- package/docs/user-manual/01-getting-started/02-quick-start.md +432 -0
- package/docs/user-manual/01-getting-started/03-authentication.md +448 -0
- package/docs/user-manual/01-getting-started/04-configuration.md +430 -0
- package/docs/user-manual/01-getting-started/05-output-formats.md +447 -0
- package/docs/user-manual/02-core-concepts/01-accounts.md +514 -0
- package/docs/user-manual/02-core-concepts/02-profile-system.md +771 -0
- package/docs/user-manual/02-core-concepts/03-smart-defaults.md +485 -0
- package/docs/user-manual/02-core-concepts/04-authentication-methods.md +435 -0
- package/docs/user-manual/02-core-concepts/05-pagination-filtering.md +600 -0
- package/docs/user-manual/02-core-concepts/06-error-handling.md +718 -0
- package/docs/user-manual/02-core-concepts/07-api-coverage.md +483 -0
- package/docs/user-manual/03-email-operations/01-senders.md +490 -0
- package/docs/user-manual/03-email-operations/02-templates.md +444 -0
- package/docs/user-manual/03-email-operations/03-transactional-emails.md +706 -0
- package/docs/user-manual/03-email-operations/04-email-tracking.md +407 -0
- package/docs/user-manual/04-campaign-management/01-campaigns-basics.md +394 -0
- package/docs/user-manual/04-campaign-management/02-campaign-scheduling.md +630 -0
- package/docs/user-manual/04-campaign-management/03-campaign-testing.md +997 -0
- package/docs/user-manual/04-campaign-management/04-campaign-lifecycle.md +709 -0
- package/docs/user-manual/04-campaign-management/05-campaign-links.md +934 -0
- package/docs/user-manual/05-contact-management/01-lists.md +836 -0
- package/docs/user-manual/05-contact-management/02-contacts.md +1035 -0
- package/docs/user-manual/05-contact-management/03-custom-attributes.md +788 -0
- package/docs/user-manual/05-contact-management/04-segments.md +1028 -0
- package/docs/user-manual/05-contact-management/05-contact-import-export.md +1031 -0
- package/docs/user-manual/06-analytics-reporting/01-campaign-analytics.md +867 -0
- package/docs/user-manual/06-analytics-reporting/02-account-reports.md +227 -0
- package/docs/user-manual/07-integrations/01-webhooks-integration.md +259 -0
- package/docs/user-manual/07-integrations/02-automation.md +326 -0
- package/docs/user-manual/08-advanced-usage/01-scripting-patterns.md +672 -0
- package/docs/user-manual/08-advanced-usage/02-bulk-operations.md +932 -0
- package/docs/user-manual/08-advanced-usage/03-ci-cd-integration.md +892 -0
- package/docs/user-manual/08-advanced-usage/04-performance-optimization.md +766 -0
- package/docs/user-manual/09-command-reference/01-config.md +776 -0
- package/docs/user-manual/09-command-reference/02-account.md +652 -0
- package/docs/user-manual/09-command-reference/03-lists.md +958 -0
- package/docs/user-manual/09-command-reference/04-contacts.md +1408 -0
- package/docs/user-manual/09-command-reference/05-attributes.md +617 -0
- package/docs/user-manual/09-command-reference/06-segments.md +894 -0
- package/docs/user-manual/09-command-reference/07-senders.md +803 -0
- package/docs/user-manual/09-command-reference/08-templates.md +818 -0
- package/docs/user-manual/09-command-reference/09-campaigns.md +1250 -0
- package/docs/user-manual/09-command-reference/10-emails.md +807 -0
- package/docs/user-manual/09-command-reference/11-reports.md +1135 -0
- package/docs/user-manual/09-command-reference/12-webhooks.md +773 -0
- package/docs/user-manual/09-command-reference/13-suppressed.md +797 -0
- package/docs/user-manual/09-command-reference/14-interests.md +630 -0
- package/docs/user-manual/09-command-reference/15-tags.md +584 -0
- package/docs/user-manual/09-command-reference/16-logs.md +656 -0
- package/docs/user-manual/09-command-reference/17-transactional-templates.md +850 -0
- package/docs/user-manual/10-troubleshooting/01-common-errors.md +457 -0
- package/docs/user-manual/10-troubleshooting/02-authentication-issues.md +558 -0
- package/docs/user-manual/10-troubleshooting/03-connection-problems.md +634 -0
- package/docs/user-manual/10-troubleshooting/04-debugging.md +725 -0
- package/docs/user-manual/11-appendix/04-faq.md +484 -0
- package/docs/user-manual/11-appendix/05-glossary.md +250 -0
- package/docs/user-manual/README.md +0 -0
- package/package.json +13 -47
- package/src/cli.ts +125 -0
- package/src/client.ts +16 -0
- package/src/commands/account.ts +267 -0
- package/src/commands/accounts.ts +78 -0
- package/src/commands/actions.ts +249 -0
- package/src/commands/attributes.ts +139 -0
- package/src/commands/campaign-blueprints.ts +106 -0
- package/src/commands/campaigns.ts +469 -0
- package/src/commands/config.ts +77 -0
- package/src/commands/contacts.ts +612 -0
- package/src/commands/custom-attributes.ts +127 -0
- package/src/commands/dkims.ts +117 -0
- package/src/commands/domains.ts +82 -0
- package/src/commands/email-apis.ts +569 -0
- package/src/commands/emails.ts +197 -0
- package/src/commands/forms.ts +283 -0
- package/src/commands/interests.ts +155 -0
- package/src/commands/links.ts +38 -0
- package/src/commands/lists.ts +406 -0
- package/src/commands/logos.ts +71 -0
- package/src/commands/logs.ts +386 -0
- package/src/commands/reports.ts +306 -0
- package/src/commands/segments.ts +158 -0
- package/src/commands/senders.ts +204 -0
- package/src/commands/sub-accounts.ts +271 -0
- package/src/commands/suppressed-emails.ts +234 -0
- package/src/commands/suppressed.ts +198 -0
- package/src/commands/system-emails.ts +85 -0
- package/src/commands/tags.ts +146 -0
- package/src/commands/tasks.ts +116 -0
- package/src/commands/templates.ts +189 -0
- package/src/commands/tokens.ts +83 -0
- package/src/commands/transactional-emails.ts +374 -0
- package/src/commands/transactional-templates.ts +385 -0
- package/src/commands/users.ts +506 -0
- package/src/commands/webhooks.ts +172 -0
- package/src/commands/workflow-blueprints.ts +123 -0
- package/src/commands/workflows.ts +265 -0
- package/src/types/profile.ts +93 -0
- package/src/utils/auth.ts +272 -0
- package/src/utils/config-file.ts +96 -0
- package/src/utils/config.ts +134 -0
- package/src/utils/confirm.ts +32 -0
- package/src/utils/defaults.ts +99 -0
- package/src/utils/errors.ts +116 -0
- package/src/utils/interactive.ts +91 -0
- package/src/utils/list-defaults.ts +74 -0
- package/src/utils/output.ts +190 -0
- package/src/utils/progress.ts +320 -0
- package/src/utils/spinner.ts +22 -0
- package/tests/IMPLEMENTATION_STATUS.md +258 -0
- package/tests/PTY_SETUP.md +118 -0
- package/tests/PTY_TESTING_GUIDE.md +507 -0
- package/tests/README.md +244 -0
- package/tests/fixtures/api-responses/campaigns.json +34 -0
- package/tests/fixtures/test-config.json +13 -0
- package/tests/helpers/cli-runner.ts +128 -0
- package/tests/helpers/mock-server.ts +301 -0
- package/tests/helpers/pty-runner.ts +181 -0
- package/tests/integration/campaigns-real-api.test.ts +196 -0
- package/tests/integration/setup-integration.ts +50 -0
- package/tests/pty/campaigns.test.ts +241 -0
- package/tests/setup.ts +34 -0
- package/tsconfig.json +15 -0
- package/vitest.config.ts +28 -0
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
# Attribute Commands
|
|
2
|
+
|
|
3
|
+
Manage custom attributes (custom fields) for storing additional contact data.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Attribute commands allow you to:
|
|
8
|
+
- Define custom fields for contacts
|
|
9
|
+
- Store additional data beyond standard fields (email, name)
|
|
10
|
+
- Create attributes with different data types
|
|
11
|
+
- List all custom attributes in a list
|
|
12
|
+
- Delete unused attributes
|
|
13
|
+
|
|
14
|
+
Custom attributes extend contact records with business-specific data like plan type, purchase history, preferences, or any other information you need to store and segment by.
|
|
15
|
+
|
|
16
|
+
All attribute operations support **smart defaults** - list IDs are auto-detected when you have only one list.
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
- [attributes list](#attributes-list) - List all custom attributes
|
|
21
|
+
- [attributes get](#attributes-get) - Get attribute details
|
|
22
|
+
- [attributes create](#attributes-create) - Create a new attribute
|
|
23
|
+
- [attributes delete](#attributes-delete) - Delete an attribute
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## attributes list
|
|
28
|
+
|
|
29
|
+
List all custom attributes defined for a list.
|
|
30
|
+
|
|
31
|
+
### Usage
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cakemail attributes list [list-id]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Arguments
|
|
38
|
+
|
|
39
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
40
|
+
|
|
41
|
+
### Examples
|
|
42
|
+
|
|
43
|
+
**List attributes with auto-detection:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
$ cakemail attributes list
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Output:**
|
|
50
|
+
```
|
|
51
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
52
|
+
┌─────────────────┬──────────┬─────────────────────┐
|
|
53
|
+
│ Name │ Type │ Created │
|
|
54
|
+
├─────────────────┼──────────┼─────────────────────┤
|
|
55
|
+
│ plan │ text │ 2024-01-15 10:30:00 │
|
|
56
|
+
│ signup_date │ date │ 2024-02-01 14:20:00 │
|
|
57
|
+
│ is_vip │ boolean │ 2024-03-01 09:00:00 │
|
|
58
|
+
│ purchase_count │ number │ 2024-03-10 16:45:00 │
|
|
59
|
+
└─────────────────┴──────────┴─────────────────────┘
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**List attributes for specific list:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
$ cakemail attributes list 123
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Export attributes as JSON:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ cakemail attributes list -f json > attributes.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Output:**
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"data": [
|
|
78
|
+
{
|
|
79
|
+
"name": "plan",
|
|
80
|
+
"type": "text",
|
|
81
|
+
"created_at": "2024-01-15T10:30:00Z"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "signup_date",
|
|
85
|
+
"type": "date",
|
|
86
|
+
"created_at": "2024-02-01T14:20:00Z"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "is_vip",
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"created_at": "2024-03-01T09:00:00Z"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "purchase_count",
|
|
95
|
+
"type": "number",
|
|
96
|
+
"created_at": "2024-03-10T16:45:00Z"
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"count": 4
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Find attributes by type:**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
$ cakemail attributes list -f json | jq '.data[] | select(.type == "text")'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Notes
|
|
110
|
+
|
|
111
|
+
- Attributes are list-specific (not shared across lists)
|
|
112
|
+
- Auto-detection works when you have exactly one list
|
|
113
|
+
- Standard fields (email, first_name, last_name) are not shown
|
|
114
|
+
- Use descriptive names for clarity
|
|
115
|
+
|
|
116
|
+
### Related Commands
|
|
117
|
+
|
|
118
|
+
- [attributes get](#attributes-get) - View attribute details
|
|
119
|
+
- [attributes create](#attributes-create) - Add new attribute
|
|
120
|
+
- [contacts add](/en/cli/command-reference/contacts#contacts-add) - Use attributes with contacts
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## attributes get
|
|
125
|
+
|
|
126
|
+
Get detailed information about a specific custom attribute.
|
|
127
|
+
|
|
128
|
+
### Usage
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cakemail attributes get [list-id] <name>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Arguments
|
|
135
|
+
|
|
136
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
137
|
+
- `name` - Attribute name (required)
|
|
138
|
+
|
|
139
|
+
### Examples
|
|
140
|
+
|
|
141
|
+
**Get attribute details with auto-detection:**
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
$ cakemail attributes get plan
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Output:**
|
|
148
|
+
```
|
|
149
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
150
|
+
{
|
|
151
|
+
"name": "plan",
|
|
152
|
+
"type": "text",
|
|
153
|
+
"list_id": 123,
|
|
154
|
+
"created_at": "2024-01-15T10:30:00Z"
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Get attribute with list ID:**
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
$ cakemail attributes get 123 plan
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Extract attribute type:**
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
$ cakemail attributes get plan -f json | jq -r '.type'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Output:**
|
|
171
|
+
```
|
|
172
|
+
text
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Notes
|
|
176
|
+
|
|
177
|
+
- Attribute names are case-sensitive
|
|
178
|
+
- Returns attribute metadata (not contact values)
|
|
179
|
+
- Auto-detection works when you have exactly one list
|
|
180
|
+
|
|
181
|
+
### Related Commands
|
|
182
|
+
|
|
183
|
+
- [attributes list](#attributes-list) - Find attribute names
|
|
184
|
+
- [contacts get](/en/cli/command-reference/contacts#contacts-get) - View attribute values
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## attributes create
|
|
189
|
+
|
|
190
|
+
Create a new custom attribute for storing additional contact data.
|
|
191
|
+
|
|
192
|
+
### Usage
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
cakemail attributes create [list-id] [options]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Arguments
|
|
199
|
+
|
|
200
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
201
|
+
|
|
202
|
+
### Options
|
|
203
|
+
|
|
204
|
+
- `-n, --name <name>` - Attribute name (required)
|
|
205
|
+
- `-t, --type <type>` - Attribute data type (required)
|
|
206
|
+
|
|
207
|
+
### Available Types
|
|
208
|
+
|
|
209
|
+
- `text` - Text strings (e.g., "premium", "New York")
|
|
210
|
+
- `number` - Numeric values (e.g., 42, 99.99)
|
|
211
|
+
- `date` - Dates in ISO format (e.g., "2024-03-15")
|
|
212
|
+
- `boolean` - True/false values
|
|
213
|
+
|
|
214
|
+
### Examples
|
|
215
|
+
|
|
216
|
+
**Create text attribute with auto-detection:**
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
$ cakemail attributes create -n "plan" -t "text"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Output:**
|
|
223
|
+
```
|
|
224
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
225
|
+
✓ Custom attribute created: plan
|
|
226
|
+
{
|
|
227
|
+
"name": "plan",
|
|
228
|
+
"type": "text",
|
|
229
|
+
"list_id": 123,
|
|
230
|
+
"created_at": "2024-03-15T10:30:00Z"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Create date attribute:**
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
$ cakemail attributes create -n "signup_date" -t "date"
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Output:**
|
|
241
|
+
```
|
|
242
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
243
|
+
✓ Custom attribute created: signup_date
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Create number attribute:**
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
$ cakemail attributes create -n "purchase_count" -t "number"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Create boolean attribute:**
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
$ cakemail attributes create -n "is_vip" -t "boolean"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Create attribute for specific list:**
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
$ cakemail attributes create 123 -n "company" -t "text"
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Create multiple attributes:**
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Customer data attributes
|
|
268
|
+
$ cakemail attributes create -n "customer_id" -t "text"
|
|
269
|
+
$ cakemail attributes create -n "lifetime_value" -t "number"
|
|
270
|
+
$ cakemail attributes create -n "last_purchase_date" -t "date"
|
|
271
|
+
$ cakemail attributes create -n "is_active" -t "boolean"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Naming Conventions
|
|
275
|
+
|
|
276
|
+
**Good attribute names:**
|
|
277
|
+
- `plan_type` - Clear, descriptive
|
|
278
|
+
- `signup_date` - Uses underscores
|
|
279
|
+
- `is_premium` - Boolean prefix
|
|
280
|
+
- `total_purchases` - Descriptive
|
|
281
|
+
|
|
282
|
+
**Avoid:**
|
|
283
|
+
- `pt` - Too short, unclear
|
|
284
|
+
- `Plan Type` - Spaces not recommended
|
|
285
|
+
- `PLAN` - All caps harder to read
|
|
286
|
+
- `planTypeForCustomer` - Too verbose
|
|
287
|
+
|
|
288
|
+
### Type Selection Guide
|
|
289
|
+
|
|
290
|
+
| Data | Type | Example Values |
|
|
291
|
+
|------|------|----------------|
|
|
292
|
+
| Categories/Labels | `text` | "premium", "basic", "trial" |
|
|
293
|
+
| Counts/Quantities | `number` | 5, 100, 1500 |
|
|
294
|
+
| Amounts/Prices | `number` | 29.99, 150.00 |
|
|
295
|
+
| Dates | `date` | "2024-03-15", "2024-12-31" |
|
|
296
|
+
| Yes/No Flags | `boolean` | true, false |
|
|
297
|
+
|
|
298
|
+
### Notes
|
|
299
|
+
|
|
300
|
+
- Attribute names must be unique within a list
|
|
301
|
+
- Names are case-sensitive
|
|
302
|
+
- Choose type carefully (cannot be changed later)
|
|
303
|
+
- Use lowercase with underscores for consistency
|
|
304
|
+
- Attribute appears immediately in contact records
|
|
305
|
+
|
|
306
|
+
### Related Commands
|
|
307
|
+
|
|
308
|
+
- [attributes list](#attributes-list) - View created attributes
|
|
309
|
+
- [contacts add](/en/cli/command-reference/contacts#contacts-add) - Add contacts with custom data
|
|
310
|
+
- [segments create](/en/cli/command-reference/segments#segments-create) - Segment by attribute
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## attributes delete
|
|
315
|
+
|
|
316
|
+
Permanently delete a custom attribute and all its data from contacts.
|
|
317
|
+
|
|
318
|
+
### Usage
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
cakemail attributes delete [list-id] <name> [options]
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Arguments
|
|
325
|
+
|
|
326
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
327
|
+
- `name` - Attribute name (required)
|
|
328
|
+
|
|
329
|
+
### Options
|
|
330
|
+
|
|
331
|
+
- `-f, --force` - Skip confirmation prompt (use in scripts)
|
|
332
|
+
|
|
333
|
+
### Examples
|
|
334
|
+
|
|
335
|
+
**Delete attribute with confirmation:**
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
$ cakemail attributes delete plan
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Output:**
|
|
342
|
+
```
|
|
343
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
344
|
+
⚠ Delete custom attribute plan?
|
|
345
|
+
|
|
346
|
+
The following will happen:
|
|
347
|
+
• Attribute and all its data will be deleted from all contacts
|
|
348
|
+
|
|
349
|
+
Type 'yes' to confirm: yes
|
|
350
|
+
|
|
351
|
+
✓ Attribute plan deleted
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Force delete without confirmation:**
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
$ cakemail attributes delete plan --force
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Output:**
|
|
361
|
+
```
|
|
362
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
363
|
+
✓ Attribute plan deleted
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**Delete with list ID:**
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
$ cakemail attributes delete 123 old_field --force
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
**Delete in script:**
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
$ cakemail attributes delete deprecated_field --force --batch
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Notes
|
|
379
|
+
|
|
380
|
+
- Deletion is **permanent** and **irreversible**
|
|
381
|
+
- All attribute values deleted from all contacts
|
|
382
|
+
- Data cannot be recovered
|
|
383
|
+
- Segments using this attribute may break
|
|
384
|
+
- Confirmation required unless `--force` is used
|
|
385
|
+
|
|
386
|
+
### Related Commands
|
|
387
|
+
|
|
388
|
+
- [attributes list](#attributes-list) - View attributes before deletion
|
|
389
|
+
- [attributes get](#attributes-get) - Review attribute details
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## Common Workflows
|
|
394
|
+
|
|
395
|
+
### Workflow 1: Setup Customer Attributes
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Create customer tracking attributes
|
|
399
|
+
$ cakemail attributes create -n "customer_id" -t "text"
|
|
400
|
+
$ cakemail attributes create -n "plan_type" -t "text"
|
|
401
|
+
$ cakemail attributes create -n "signup_date" -t "date"
|
|
402
|
+
$ cakemail attributes create -n "is_paid" -t "boolean"
|
|
403
|
+
$ cakemail attributes create -n "lifetime_value" -t "number"
|
|
404
|
+
|
|
405
|
+
# List all attributes
|
|
406
|
+
$ cakemail attributes list
|
|
407
|
+
|
|
408
|
+
# Add contact with custom data
|
|
409
|
+
$ cakemail contacts add \
|
|
410
|
+
-e "john@example.com" \
|
|
411
|
+
-f "John" \
|
|
412
|
+
-l "Doe" \
|
|
413
|
+
-d '{"customer_id":"CUST-001","plan_type":"premium","signup_date":"2024-03-15","is_paid":true,"lifetime_value":299.99}'
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Workflow 2: E-commerce Attributes
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Create e-commerce tracking attributes
|
|
420
|
+
$ cakemail attributes create -n "total_orders" -t "number"
|
|
421
|
+
$ cakemail attributes create -n "last_order_date" -t "date"
|
|
422
|
+
$ cakemail attributes create -n "favorite_category" -t "text"
|
|
423
|
+
$ cakemail attributes create -n "vip_member" -t "boolean"
|
|
424
|
+
$ cakemail attributes create -n "cart_abandoned" -t "boolean"
|
|
425
|
+
|
|
426
|
+
# Create segment for cart abandonment
|
|
427
|
+
$ cakemail segments create -n "Cart Abandoned" \
|
|
428
|
+
-c '{
|
|
429
|
+
"match": "all",
|
|
430
|
+
"rules": [
|
|
431
|
+
{"field": "custom_attributes.cart_abandoned", "operator": "equals", "value": "true"},
|
|
432
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-01-01"}
|
|
433
|
+
]
|
|
434
|
+
}'
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Workflow 3: Subscription Management
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
# Create subscription attributes
|
|
441
|
+
$ cakemail attributes create -n "subscription_tier" -t "text"
|
|
442
|
+
$ cakemail attributes create -n "renewal_date" -t "date"
|
|
443
|
+
$ cakemail attributes create -n "auto_renew" -t "boolean"
|
|
444
|
+
$ cakemail attributes create -n "months_subscribed" -t "number"
|
|
445
|
+
|
|
446
|
+
# Segment by subscription tier
|
|
447
|
+
$ cakemail segments create -n "Premium Subscribers" \
|
|
448
|
+
-c '{
|
|
449
|
+
"match": "all",
|
|
450
|
+
"rules": [
|
|
451
|
+
{"field": "custom_attributes.subscription_tier", "operator": "equals", "value": "premium"}
|
|
452
|
+
]
|
|
453
|
+
}'
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Workflow 4: Attribute Audit and Cleanup
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# List all attributes
|
|
460
|
+
$ cakemail attributes list
|
|
461
|
+
|
|
462
|
+
# Check each attribute usage
|
|
463
|
+
for attr in plan signup_date is_vip; do
|
|
464
|
+
echo "Attribute: $attr"
|
|
465
|
+
cakemail attributes get $attr
|
|
466
|
+
done
|
|
467
|
+
|
|
468
|
+
# Delete unused attributes
|
|
469
|
+
$ cakemail attributes delete old_field --force
|
|
470
|
+
$ cakemail attributes delete deprecated_attr --force
|
|
471
|
+
|
|
472
|
+
# Verify cleanup
|
|
473
|
+
$ cakemail attributes list
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Workflow 5: Data Migration
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Export current attributes
|
|
480
|
+
$ cakemail attributes list -f json > attributes-backup.json
|
|
481
|
+
|
|
482
|
+
# Backup contact data
|
|
483
|
+
$ cakemail contacts export
|
|
484
|
+
|
|
485
|
+
# Recreate attributes in new list
|
|
486
|
+
for attr in $(jq -r '.data[] | "\(.name):\(.type)"' attributes-backup.json); do
|
|
487
|
+
name=$(echo $attr | cut -d: -f1)
|
|
488
|
+
type=$(echo $attr | cut -d: -f2)
|
|
489
|
+
cakemail attributes create 124 -n "$name" -t "$type"
|
|
490
|
+
done
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## Best Practices
|
|
494
|
+
|
|
495
|
+
1. **Plan Ahead**: Define all needed attributes before importing contacts
|
|
496
|
+
2. **Descriptive Names**: Use clear, self-explanatory attribute names
|
|
497
|
+
3. **Consistent Naming**: Use lowercase with underscores (snake_case)
|
|
498
|
+
4. **Choose Type Carefully**: Type cannot be changed after creation
|
|
499
|
+
5. **Boolean Prefix**: Name boolean attributes with "is_" or "has_" prefix
|
|
500
|
+
6. **Document Attributes**: Keep list of attributes and their purposes
|
|
501
|
+
7. **Avoid Over-Engineering**: Only create attributes you'll actually use
|
|
502
|
+
8. **Regular Cleanup**: Delete deprecated attributes periodically
|
|
503
|
+
|
|
504
|
+
## Troubleshooting
|
|
505
|
+
|
|
506
|
+
### Error: "Attribute name already exists"
|
|
507
|
+
|
|
508
|
+
Attribute with that name already defined.
|
|
509
|
+
|
|
510
|
+
**Solution:**
|
|
511
|
+
```bash
|
|
512
|
+
# List existing attributes
|
|
513
|
+
$ cakemail attributes list
|
|
514
|
+
|
|
515
|
+
# Use different name or delete existing
|
|
516
|
+
$ cakemail attributes delete old_name --force
|
|
517
|
+
$ cakemail attributes create -n "old_name" -t "text"
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Error: "List ID not found"
|
|
521
|
+
|
|
522
|
+
Auto-detection failed or invalid list ID.
|
|
523
|
+
|
|
524
|
+
**Solution:**
|
|
525
|
+
```bash
|
|
526
|
+
# List your lists
|
|
527
|
+
$ cakemail lists list
|
|
528
|
+
|
|
529
|
+
# Use specific list ID
|
|
530
|
+
$ cakemail attributes list 123
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### Error: "Invalid attribute type"
|
|
534
|
+
|
|
535
|
+
Type must be one of: text, number, date, boolean.
|
|
536
|
+
|
|
537
|
+
**Solution:**
|
|
538
|
+
```bash
|
|
539
|
+
# Use valid type
|
|
540
|
+
$ cakemail attributes create -n "plan" -t "text"
|
|
541
|
+
|
|
542
|
+
# Not valid: "string", "integer", "bool"
|
|
543
|
+
# Valid: "text", "number", "date", "boolean"
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### Attribute Not Appearing in Contacts
|
|
547
|
+
|
|
548
|
+
Contact may not have value for attribute.
|
|
549
|
+
|
|
550
|
+
**Solution:**
|
|
551
|
+
```bash
|
|
552
|
+
# Check contact data
|
|
553
|
+
$ cakemail contacts get 123 501 -f json | jq '.custom_attributes'
|
|
554
|
+
|
|
555
|
+
# Add attribute value to contact
|
|
556
|
+
$ cakemail contacts update 123 501 -d '{"plan":"premium"}'
|
|
557
|
+
|
|
558
|
+
# Verify update
|
|
559
|
+
$ cakemail contacts get 123 501 -f json | jq '.custom_attributes.plan'
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Cannot Delete Attribute
|
|
563
|
+
|
|
564
|
+
Attribute may be in use by segments.
|
|
565
|
+
|
|
566
|
+
**Solution:**
|
|
567
|
+
```bash
|
|
568
|
+
# Find segments using attribute
|
|
569
|
+
$ cakemail segments list -f json | jq '.data[] | select(.conditions.rules[]?.field | contains("plan"))'
|
|
570
|
+
|
|
571
|
+
# Update or delete segments first
|
|
572
|
+
$ cakemail segments delete 456 --force
|
|
573
|
+
|
|
574
|
+
# Then delete attribute
|
|
575
|
+
$ cakemail attributes delete plan --force
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### Wrong Data Type Used
|
|
579
|
+
|
|
580
|
+
Type cannot be changed once created.
|
|
581
|
+
|
|
582
|
+
**Solution:**
|
|
583
|
+
```bash
|
|
584
|
+
# Create new attribute with correct type
|
|
585
|
+
$ cakemail attributes create -n "plan_id_new" -t "number"
|
|
586
|
+
|
|
587
|
+
# Migrate data (manual process or script)
|
|
588
|
+
# Update contacts to use new attribute
|
|
589
|
+
|
|
590
|
+
# Delete old attribute
|
|
591
|
+
$ cakemail attributes delete plan_id --force
|
|
592
|
+
|
|
593
|
+
# Optionally rename new attribute
|
|
594
|
+
# (requires recreate, no rename command)
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Date Format Issues
|
|
598
|
+
|
|
599
|
+
Dates must be ISO format (YYYY-MM-DD).
|
|
600
|
+
|
|
601
|
+
**Solution:**
|
|
602
|
+
```bash
|
|
603
|
+
# Correct date format
|
|
604
|
+
$ cakemail contacts add \
|
|
605
|
+
-e "user@example.com" \
|
|
606
|
+
-d '{"signup_date":"2024-03-15"}'
|
|
607
|
+
|
|
608
|
+
# Not valid: "03/15/2024", "March 15, 2024", "15-03-2024"
|
|
609
|
+
# Valid: "2024-03-15"
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
**Related Documentation:**
|
|
615
|
+
- [Contacts Commands](/en/cli/command-reference/contacts/) - Manage contact data
|
|
616
|
+
- [Segments Commands](/en/cli/command-reference/segments/) - Segment by custom attributes
|
|
617
|
+
- [Lists Commands](/en/cli/command-reference/lists/) - Manage contact lists
|