@cakemail-org/cakemail-cli 1.7.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 +41 -37
- package/audit-formats.js +128 -0
- package/cakemail.rb +20 -0
- package/dist/client.js +1 -1
- 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.js +1 -1
- package/dist/commands/campaigns.js.map +1 -1
- package/dist/commands/contacts.js +1 -1
- 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.js +1 -1
- package/dist/commands/interests.js.map +1 -1
- package/dist/commands/lists.js +1 -1
- package/dist/commands/lists.js.map +1 -1
- package/dist/commands/logs.js +1 -1
- package/dist/commands/logs.js.map +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/dist/commands/tags.js.map +1 -1
- package/dist/commands/templates.js +1 -1
- package/dist/commands/templates.js.map +1 -1
- package/dist/commands/transactional-templates.js +1 -1
- package/dist/commands/transactional-templates.js.map +1 -1
- package/dist/commands/webhooks.js +1 -1
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/utils/config.js +2 -2
- 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/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 -61
- 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,894 @@
|
|
|
1
|
+
# Segment Commands
|
|
2
|
+
|
|
3
|
+
Manage dynamic contact segments with condition-based filtering.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Segment commands allow you to:
|
|
8
|
+
- Create dynamic segments based on contact attributes
|
|
9
|
+
- Filter contacts using complex conditions
|
|
10
|
+
- Update segment definitions
|
|
11
|
+
- List contacts matching segment criteria
|
|
12
|
+
- Delete unused segments
|
|
13
|
+
|
|
14
|
+
Segments are dynamic filters that automatically include contacts matching specified conditions. Unlike static lists, segment membership updates automatically as contact data changes.
|
|
15
|
+
|
|
16
|
+
All segment operations support **smart defaults** - list IDs are auto-detected when you have only one list.
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
- [segments list](#segments-list) - List all segments in a list
|
|
21
|
+
- [segments get](#segments-get) - Get segment details
|
|
22
|
+
- [segments create](#segments-create) - Create a new segment
|
|
23
|
+
- [segments update](#segments-update) - Update segment definition
|
|
24
|
+
- [segments delete](#segments-delete) - Delete a segment
|
|
25
|
+
- [segments contacts](#segments-contacts) - List contacts in segment
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## segments list
|
|
30
|
+
|
|
31
|
+
List all segments in a list with pagination support.
|
|
32
|
+
|
|
33
|
+
### Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cakemail segments list [list-id] [options]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Arguments
|
|
40
|
+
|
|
41
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
42
|
+
|
|
43
|
+
### Options
|
|
44
|
+
|
|
45
|
+
- `-l, --limit <number>` - Limit number of results per page
|
|
46
|
+
- `-p, --page <number>` - Page number (default: 1)
|
|
47
|
+
|
|
48
|
+
### Examples
|
|
49
|
+
|
|
50
|
+
**List segments with auto-detection:**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
$ cakemail segments list
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Output:**
|
|
57
|
+
```
|
|
58
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
59
|
+
┌────────┬─────────────────────┬────────────┬─────────────────────┐
|
|
60
|
+
│ ID │ Name │ Contacts │ Created │
|
|
61
|
+
├────────┼─────────────────────┼────────────┼─────────────────────┤
|
|
62
|
+
│ 456 │ Active Subscribers │ 1,180 │ 2024-01-15 10:30:00 │
|
|
63
|
+
│ 457 │ High Engagement │ 342 │ 2024-02-01 14:20:00 │
|
|
64
|
+
│ 458 │ VIP Customers │ 45 │ 2024-03-01 09:00:00 │
|
|
65
|
+
└────────┴─────────────────────┴────────────┴─────────────────────┘
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**List segments for specific list:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
$ cakemail segments list 123
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**List with pagination:**
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
$ cakemail segments list 123 -l 10 -p 1
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Export segment list as JSON:**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
$ cakemail segments list 123 -f json > segments.json
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Output:**
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"data": [
|
|
90
|
+
{
|
|
91
|
+
"id": 456,
|
|
92
|
+
"name": "Active Subscribers",
|
|
93
|
+
"contact_count": 1180,
|
|
94
|
+
"created_at": "2024-01-15T10:30:00Z"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"count": 3
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Notes
|
|
102
|
+
|
|
103
|
+
- Contact counts update dynamically as contacts meet/don't meet criteria
|
|
104
|
+
- Auto-detection works when you have exactly one list
|
|
105
|
+
- Use pagination for lists with many segments
|
|
106
|
+
- Segments are list-specific (not shared across lists)
|
|
107
|
+
|
|
108
|
+
### Related Commands
|
|
109
|
+
|
|
110
|
+
- [segments get](#segments-get) - View segment details
|
|
111
|
+
- [segments create](#segments-create) - Create new segment
|
|
112
|
+
- [lists list](/en/cli/command-reference/lists#lists-list) - View all lists
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## segments get
|
|
117
|
+
|
|
118
|
+
Get detailed information about a specific segment including conditions.
|
|
119
|
+
|
|
120
|
+
### Usage
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cakemail segments get [list-id] <segment-id>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Arguments
|
|
127
|
+
|
|
128
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
129
|
+
- `segment-id` - Segment ID (required)
|
|
130
|
+
|
|
131
|
+
### Examples
|
|
132
|
+
|
|
133
|
+
**Get segment details with auto-detection:**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
$ cakemail segments get 456
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Output:**
|
|
140
|
+
```
|
|
141
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
142
|
+
{
|
|
143
|
+
"id": 456,
|
|
144
|
+
"name": "Active Subscribers",
|
|
145
|
+
"list_id": 123,
|
|
146
|
+
"contact_count": 1180,
|
|
147
|
+
"conditions": {
|
|
148
|
+
"match": "all",
|
|
149
|
+
"rules": [
|
|
150
|
+
{
|
|
151
|
+
"field": "status",
|
|
152
|
+
"operator": "equals",
|
|
153
|
+
"value": "subscribed"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"field": "last_open_date",
|
|
157
|
+
"operator": "greater_than",
|
|
158
|
+
"value": "2024-01-01"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"created_at": "2024-01-15T10:30:00Z",
|
|
163
|
+
"updated_at": "2024-03-10T16:45:00Z"
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Get segment with list ID:**
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
$ cakemail segments get 123 456
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Extract segment conditions:**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
$ cakemail segments get 456 -f json | jq '.conditions'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Output:**
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"match": "all",
|
|
183
|
+
"rules": [
|
|
184
|
+
{
|
|
185
|
+
"field": "status",
|
|
186
|
+
"operator": "equals",
|
|
187
|
+
"value": "subscribed"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"field": "last_open_date",
|
|
191
|
+
"operator": "greater_than",
|
|
192
|
+
"value": "2024-01-01"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Check segment size:**
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
$ cakemail segments get 456 -f json | jq '.contact_count'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Output:**
|
|
205
|
+
```
|
|
206
|
+
1180
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Notes
|
|
210
|
+
|
|
211
|
+
- Contact count updates dynamically
|
|
212
|
+
- Conditions define which contacts are included
|
|
213
|
+
- `match: "all"` means contacts must meet all rules
|
|
214
|
+
- `match: "any"` means contacts need to meet at least one rule
|
|
215
|
+
- Auto-detection works when you have exactly one list
|
|
216
|
+
|
|
217
|
+
### Related Commands
|
|
218
|
+
|
|
219
|
+
- [segments contacts](#segments-contacts) - View contacts in segment
|
|
220
|
+
- [segments update](#segments-update) - Modify segment conditions
|
|
221
|
+
- [segments list](#segments-list) - Find segment IDs
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## segments create
|
|
226
|
+
|
|
227
|
+
Create a new segment with condition-based filtering.
|
|
228
|
+
|
|
229
|
+
### Usage
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
cakemail segments create [list-id] [options]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Arguments
|
|
236
|
+
|
|
237
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
238
|
+
|
|
239
|
+
### Options
|
|
240
|
+
|
|
241
|
+
- `-n, --name <name>` - Segment name (required)
|
|
242
|
+
- `-c, --conditions <json>` - Segment conditions as JSON (optional)
|
|
243
|
+
|
|
244
|
+
### Examples
|
|
245
|
+
|
|
246
|
+
**Create simple segment with auto-detection:**
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
$ cakemail segments create -n "Active Subscribers"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Output:**
|
|
253
|
+
```
|
|
254
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
255
|
+
✓ Segment created: 456
|
|
256
|
+
{
|
|
257
|
+
"id": 456,
|
|
258
|
+
"name": "Active Subscribers",
|
|
259
|
+
"list_id": 123,
|
|
260
|
+
"contact_count": 0
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Create segment with conditions:**
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
$ cakemail segments create -n "High Engagement" \
|
|
268
|
+
-c '{
|
|
269
|
+
"match": "all",
|
|
270
|
+
"rules": [
|
|
271
|
+
{"field": "status", "operator": "equals", "value": "subscribed"},
|
|
272
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-01-01"}
|
|
273
|
+
]
|
|
274
|
+
}'
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Output:**
|
|
278
|
+
```
|
|
279
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
280
|
+
✓ Segment created: 457
|
|
281
|
+
{
|
|
282
|
+
"id": 457,
|
|
283
|
+
"name": "High Engagement",
|
|
284
|
+
"contact_count": 342,
|
|
285
|
+
"conditions": {
|
|
286
|
+
"match": "all",
|
|
287
|
+
"rules": [...]
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Create segment for specific list:**
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
$ cakemail segments create 123 -n "VIP Customers" \
|
|
296
|
+
-c '{
|
|
297
|
+
"match": "all",
|
|
298
|
+
"rules": [
|
|
299
|
+
{"field": "custom_attributes.plan", "operator": "equals", "value": "premium"}
|
|
300
|
+
]
|
|
301
|
+
}'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Create segment with "any" match:**
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
$ cakemail segments create -n "Engaged or Recent" \
|
|
308
|
+
-c '{
|
|
309
|
+
"match": "any",
|
|
310
|
+
"rules": [
|
|
311
|
+
{"field": "last_click_date", "operator": "greater_than", "value": "2024-03-01"},
|
|
312
|
+
{"field": "subscribed_on", "operator": "greater_than", "value": "2024-03-01"}
|
|
313
|
+
]
|
|
314
|
+
}'
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Output:**
|
|
318
|
+
```
|
|
319
|
+
✓ Segment created: 458
|
|
320
|
+
{
|
|
321
|
+
"id": 458,
|
|
322
|
+
"name": "Engaged or Recent",
|
|
323
|
+
"contact_count": 567
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### Condition Structure
|
|
328
|
+
|
|
329
|
+
```json
|
|
330
|
+
{
|
|
331
|
+
"match": "all|any",
|
|
332
|
+
"rules": [
|
|
333
|
+
{
|
|
334
|
+
"field": "field_name",
|
|
335
|
+
"operator": "operator_type",
|
|
336
|
+
"value": "comparison_value"
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Available Operators
|
|
343
|
+
|
|
344
|
+
- `equals` - Exact match
|
|
345
|
+
- `not_equals` - Not equal to
|
|
346
|
+
- `greater_than` - Greater than (numbers, dates)
|
|
347
|
+
- `less_than` - Less than (numbers, dates)
|
|
348
|
+
- `contains` - Contains substring
|
|
349
|
+
- `not_contains` - Does not contain
|
|
350
|
+
- `starts_with` - Starts with
|
|
351
|
+
- `ends_with` - Ends with
|
|
352
|
+
- `is_empty` - Field is empty/null
|
|
353
|
+
- `is_not_empty` - Field has value
|
|
354
|
+
|
|
355
|
+
### Common Fields
|
|
356
|
+
|
|
357
|
+
- `email` - Contact email
|
|
358
|
+
- `first_name` - Contact first name
|
|
359
|
+
- `last_name` - Contact last name
|
|
360
|
+
- `status` - Subscription status (subscribed, unsubscribed)
|
|
361
|
+
- `subscribed_on` - Subscription date
|
|
362
|
+
- `last_open_date` - Last email open date
|
|
363
|
+
- `last_click_date` - Last link click date
|
|
364
|
+
- `custom_attributes.field_name` - Custom attribute value
|
|
365
|
+
|
|
366
|
+
### Notes
|
|
367
|
+
|
|
368
|
+
- Segments update dynamically as contact data changes
|
|
369
|
+
- Empty conditions segment includes all contacts
|
|
370
|
+
- Custom attributes accessed via dot notation
|
|
371
|
+
- Date values in ISO format (YYYY-MM-DD)
|
|
372
|
+
- Contact count calculated immediately
|
|
373
|
+
|
|
374
|
+
### Related Commands
|
|
375
|
+
|
|
376
|
+
- [segments get](#segments-get) - View created segment
|
|
377
|
+
- [segments contacts](#segments-contacts) - View matching contacts
|
|
378
|
+
- [segments update](#segments-update) - Modify conditions
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## segments update
|
|
383
|
+
|
|
384
|
+
Update an existing segment's name or conditions.
|
|
385
|
+
|
|
386
|
+
### Usage
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
cakemail segments update [list-id] <segment-id> [options]
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Arguments
|
|
393
|
+
|
|
394
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
395
|
+
- `segment-id` - Segment ID (required)
|
|
396
|
+
|
|
397
|
+
### Options
|
|
398
|
+
|
|
399
|
+
- `-n, --name <name>` - New segment name
|
|
400
|
+
- `-c, --conditions <json>` - New segment conditions as JSON
|
|
401
|
+
|
|
402
|
+
### Examples
|
|
403
|
+
|
|
404
|
+
**Update segment name:**
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
$ cakemail segments update 456 -n "Highly Active Subscribers"
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Output:**
|
|
411
|
+
```
|
|
412
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
413
|
+
✓ Segment 456 updated
|
|
414
|
+
{
|
|
415
|
+
"id": 456,
|
|
416
|
+
"name": "Highly Active Subscribers",
|
|
417
|
+
"contact_count": 1180
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Update segment conditions:**
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
$ cakemail segments update 456 \
|
|
425
|
+
-c '{
|
|
426
|
+
"match": "all",
|
|
427
|
+
"rules": [
|
|
428
|
+
{"field": "status", "operator": "equals", "value": "subscribed"},
|
|
429
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-02-01"}
|
|
430
|
+
]
|
|
431
|
+
}'
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**Output:**
|
|
435
|
+
```
|
|
436
|
+
✓ Segment 456 updated
|
|
437
|
+
{
|
|
438
|
+
"id": 456,
|
|
439
|
+
"name": "Highly Active Subscribers",
|
|
440
|
+
"contact_count": 892,
|
|
441
|
+
"conditions": {...}
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Update both name and conditions:**
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
$ cakemail segments update 123 456 \
|
|
449
|
+
-n "Premium Customers" \
|
|
450
|
+
-c '{
|
|
451
|
+
"match": "all",
|
|
452
|
+
"rules": [
|
|
453
|
+
{"field": "custom_attributes.plan", "operator": "equals", "value": "premium"},
|
|
454
|
+
{"field": "status", "operator": "equals", "value": "subscribed"}
|
|
455
|
+
]
|
|
456
|
+
}'
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Broaden segment criteria:**
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
$ cakemail segments update 457 \
|
|
463
|
+
-c '{
|
|
464
|
+
"match": "any",
|
|
465
|
+
"rules": [
|
|
466
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-01-01"},
|
|
467
|
+
{"field": "last_click_date", "operator": "greater_than", "value": "2024-01-01"}
|
|
468
|
+
]
|
|
469
|
+
}'
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Notes
|
|
473
|
+
|
|
474
|
+
- Only provided fields are updated (partial updates)
|
|
475
|
+
- Contact count recalculates immediately
|
|
476
|
+
- Changing conditions affects which contacts are included
|
|
477
|
+
- Use [segments contacts](#segments-contacts) to preview changes
|
|
478
|
+
|
|
479
|
+
### Related Commands
|
|
480
|
+
|
|
481
|
+
- [segments get](#segments-get) - View current segment definition
|
|
482
|
+
- [segments contacts](#segments-contacts) - Preview affected contacts
|
|
483
|
+
- [segments create](#segments-create) - Create new segment
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
## segments delete
|
|
488
|
+
|
|
489
|
+
Permanently delete a segment.
|
|
490
|
+
|
|
491
|
+
### Usage
|
|
492
|
+
|
|
493
|
+
```bash
|
|
494
|
+
cakemail segments delete [list-id] <segment-id> [options]
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Arguments
|
|
498
|
+
|
|
499
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
500
|
+
- `segment-id` - Segment ID (required)
|
|
501
|
+
|
|
502
|
+
### Options
|
|
503
|
+
|
|
504
|
+
- `-f, --force` - Skip confirmation prompt (use in scripts)
|
|
505
|
+
|
|
506
|
+
### Examples
|
|
507
|
+
|
|
508
|
+
**Delete segment with confirmation:**
|
|
509
|
+
|
|
510
|
+
```bash
|
|
511
|
+
$ cakemail segments delete 456
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Output:**
|
|
515
|
+
```
|
|
516
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
517
|
+
⚠ Delete segment 456?
|
|
518
|
+
|
|
519
|
+
The following will happen:
|
|
520
|
+
• Segment will be permanently deleted
|
|
521
|
+
|
|
522
|
+
Type 'yes' to confirm: yes
|
|
523
|
+
|
|
524
|
+
✓ Segment 456 deleted
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
**Force delete without confirmation:**
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
$ cakemail segments delete 456 --force
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**Output:**
|
|
534
|
+
```
|
|
535
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
536
|
+
✓ Segment 456 deleted
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
**Delete with list ID:**
|
|
540
|
+
|
|
541
|
+
```bash
|
|
542
|
+
$ cakemail segments delete 123 456 --force
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
**Delete in script:**
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
$ cakemail segments delete 456 --force --batch
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Notes
|
|
552
|
+
|
|
553
|
+
- Deletion is permanent and cannot be undone
|
|
554
|
+
- Contacts in the segment are not deleted (only the segment definition)
|
|
555
|
+
- Campaigns previously sent to this segment remain in history
|
|
556
|
+
- No confirmation shown when `--force` is used
|
|
557
|
+
|
|
558
|
+
### Related Commands
|
|
559
|
+
|
|
560
|
+
- [segments list](#segments-list) - View segments before deletion
|
|
561
|
+
- [segments get](#segments-get) - Review segment details
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## segments contacts
|
|
566
|
+
|
|
567
|
+
List all contacts that match a segment's conditions.
|
|
568
|
+
|
|
569
|
+
### Usage
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
cakemail segments contacts [list-id] <segment-id> [options]
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Arguments
|
|
576
|
+
|
|
577
|
+
- `list-id` - List ID (optional - auto-detected if only one list exists)
|
|
578
|
+
- `segment-id` - Segment ID (required)
|
|
579
|
+
|
|
580
|
+
### Options
|
|
581
|
+
|
|
582
|
+
- `-l, --limit <number>` - Limit number of results per page
|
|
583
|
+
- `-p, --page <number>` - Page number (default: 1)
|
|
584
|
+
|
|
585
|
+
### Examples
|
|
586
|
+
|
|
587
|
+
**List segment contacts with auto-detection:**
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
$ cakemail segments contacts 456
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
**Output:**
|
|
594
|
+
```
|
|
595
|
+
✓ Auto-detected list: 123 (Newsletter Subscribers)
|
|
596
|
+
┌────────┬──────────────────────┬────────────┬────────────┬──────────────┐
|
|
597
|
+
│ ID │ Email │ First Name │ Last Name │ Status │
|
|
598
|
+
├────────┼──────────────────────┼────────────┼────────────┼──────────────┤
|
|
599
|
+
│ 501 │ john@example.com │ John │ Doe │ subscribed │
|
|
600
|
+
│ 502 │ jane@example.com │ Jane │ Smith │ subscribed │
|
|
601
|
+
│ 503 │ bob@example.com │ Bob │ Johnson │ subscribed │
|
|
602
|
+
└────────┴──────────────────────┴────────────┴────────────┴──────────────┘
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
**List with list ID:**
|
|
606
|
+
|
|
607
|
+
```bash
|
|
608
|
+
$ cakemail segments contacts 123 456
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
**List with pagination:**
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
$ cakemail segments contacts 456 -l 50 -p 1
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
**Export segment contacts:**
|
|
618
|
+
|
|
619
|
+
```bash
|
|
620
|
+
$ cakemail segments contacts 456 -f json > segment-contacts.json
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**Count segment contacts:**
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
$ cakemail segments contacts 456 -f json | jq '.count'
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
**Output:**
|
|
630
|
+
```
|
|
631
|
+
1180
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
**Extract email addresses:**
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
$ cakemail segments contacts 456 -f json | jq -r '.data[].email' > emails.txt
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### Notes
|
|
641
|
+
|
|
642
|
+
- Results update dynamically based on segment conditions
|
|
643
|
+
- Same contact filtering as [contacts list](/en/cli/command-reference/contacts#contacts-list)
|
|
644
|
+
- Use pagination for large segments
|
|
645
|
+
- Useful for previewing segment before sending campaign
|
|
646
|
+
|
|
647
|
+
### Related Commands
|
|
648
|
+
|
|
649
|
+
- [segments get](#segments-get) - View segment definition
|
|
650
|
+
- [contacts list](/en/cli/command-reference/contacts#contacts-list) - List all contacts
|
|
651
|
+
- [campaigns create](/en/cli/command-reference/campaigns#campaigns-create) - Send to segment
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## Common Workflows
|
|
656
|
+
|
|
657
|
+
### Workflow 1: Create Engagement-Based Segment
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
# Create segment for highly engaged contacts
|
|
661
|
+
$ cakemail segments create -n "Highly Engaged" \
|
|
662
|
+
-c '{
|
|
663
|
+
"match": "all",
|
|
664
|
+
"rules": [
|
|
665
|
+
{"field": "status", "operator": "equals", "value": "subscribed"},
|
|
666
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-01-01"},
|
|
667
|
+
{"field": "last_click_date", "operator": "greater_than", "value": "2024-01-01"}
|
|
668
|
+
]
|
|
669
|
+
}'
|
|
670
|
+
|
|
671
|
+
# Check segment size
|
|
672
|
+
$ cakemail segments get 456 -f json | jq '.contact_count'
|
|
673
|
+
|
|
674
|
+
# Preview contacts
|
|
675
|
+
$ cakemail segments contacts 456 -l 10
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### Workflow 2: Target Recent Subscribers
|
|
679
|
+
|
|
680
|
+
```bash
|
|
681
|
+
# Create segment for new subscribers (last 30 days)
|
|
682
|
+
$ cakemail segments create -n "New Subscribers" \
|
|
683
|
+
-c '{
|
|
684
|
+
"match": "all",
|
|
685
|
+
"rules": [
|
|
686
|
+
{"field": "subscribed_on", "operator": "greater_than", "value": "2024-02-15"}
|
|
687
|
+
]
|
|
688
|
+
}'
|
|
689
|
+
|
|
690
|
+
# Send welcome campaign to segment
|
|
691
|
+
$ cakemail campaigns create \
|
|
692
|
+
-n "Welcome Series" \
|
|
693
|
+
-l 123 \
|
|
694
|
+
-s 101 \
|
|
695
|
+
--segment 457
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Workflow 3: Re-engagement Campaign
|
|
699
|
+
|
|
700
|
+
```bash
|
|
701
|
+
# Create segment for inactive subscribers
|
|
702
|
+
$ cakemail segments create -n "Inactive Subscribers" \
|
|
703
|
+
-c '{
|
|
704
|
+
"match": "all",
|
|
705
|
+
"rules": [
|
|
706
|
+
{"field": "status", "operator": "equals", "value": "subscribed"},
|
|
707
|
+
{"field": "last_open_date", "operator": "less_than", "value": "2023-12-01"}
|
|
708
|
+
]
|
|
709
|
+
}'
|
|
710
|
+
|
|
711
|
+
# Check size
|
|
712
|
+
$ cakemail segments get 458 -f json | jq '.contact_count'
|
|
713
|
+
|
|
714
|
+
# Export for analysis
|
|
715
|
+
$ cakemail segments contacts 458 -f json > inactive-contacts.json
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### Workflow 4: Custom Attribute Targeting
|
|
719
|
+
|
|
720
|
+
```bash
|
|
721
|
+
# Create segment based on custom attributes
|
|
722
|
+
$ cakemail segments create -n "Premium Plan Users" \
|
|
723
|
+
-c '{
|
|
724
|
+
"match": "all",
|
|
725
|
+
"rules": [
|
|
726
|
+
{"field": "custom_attributes.plan", "operator": "equals", "value": "premium"},
|
|
727
|
+
{"field": "custom_attributes.active", "operator": "equals", "value": "true"}
|
|
728
|
+
]
|
|
729
|
+
}'
|
|
730
|
+
|
|
731
|
+
# List premium users
|
|
732
|
+
$ cakemail segments contacts 459 -l 100
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
### Workflow 5: Segment Cleanup
|
|
736
|
+
|
|
737
|
+
```bash
|
|
738
|
+
# List all segments
|
|
739
|
+
$ cakemail segments list
|
|
740
|
+
|
|
741
|
+
# Check each segment size
|
|
742
|
+
for id in 456 457 458; do
|
|
743
|
+
echo "Segment $id:"
|
|
744
|
+
cakemail segments get $id -f json | jq '{name, contacts: .contact_count}'
|
|
745
|
+
done
|
|
746
|
+
|
|
747
|
+
# Delete unused segments
|
|
748
|
+
$ cakemail segments delete 460 --force
|
|
749
|
+
$ cakemail segments delete 461 --force
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
## Best Practices
|
|
753
|
+
|
|
754
|
+
1. **Descriptive Names**: Use clear segment names that describe the criteria
|
|
755
|
+
2. **Test Conditions**: Preview contacts before using segment in campaigns
|
|
756
|
+
3. **Regular Reviews**: Periodically review and update segment conditions
|
|
757
|
+
4. **Performance**: Keep condition rules simple for faster evaluation
|
|
758
|
+
5. **Documentation**: Document complex segment logic for team reference
|
|
759
|
+
6. **Avoid Over-Segmentation**: Don't create too many narrow segments
|
|
760
|
+
7. **Dynamic Updates**: Leverage segments' dynamic nature instead of static exports
|
|
761
|
+
8. **Date-Based Rules**: Use date comparisons for time-sensitive targeting
|
|
762
|
+
|
|
763
|
+
## Troubleshooting
|
|
764
|
+
|
|
765
|
+
### Error: "List ID not found"
|
|
766
|
+
|
|
767
|
+
Auto-detection failed or invalid list ID.
|
|
768
|
+
|
|
769
|
+
**Solution:**
|
|
770
|
+
```bash
|
|
771
|
+
# List your lists
|
|
772
|
+
$ cakemail lists list
|
|
773
|
+
|
|
774
|
+
# Use specific list ID
|
|
775
|
+
$ cakemail segments list 123
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
### Segment Has Zero Contacts
|
|
779
|
+
|
|
780
|
+
Conditions may be too restrictive or no contacts match criteria.
|
|
781
|
+
|
|
782
|
+
**Solution:**
|
|
783
|
+
```bash
|
|
784
|
+
# Review segment conditions
|
|
785
|
+
$ cakemail segments get 456 -f json | jq '.conditions'
|
|
786
|
+
|
|
787
|
+
# Test with broader conditions
|
|
788
|
+
$ cakemail segments update 456 \
|
|
789
|
+
-c '{
|
|
790
|
+
"match": "any",
|
|
791
|
+
"rules": [
|
|
792
|
+
{"field": "status", "operator": "equals", "value": "subscribed"}
|
|
793
|
+
]
|
|
794
|
+
}'
|
|
795
|
+
|
|
796
|
+
# Check contact count
|
|
797
|
+
$ cakemail segments get 456 -f json | jq '.contact_count'
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
### Invalid JSON in Conditions
|
|
801
|
+
|
|
802
|
+
Malformed JSON causes creation/update to fail.
|
|
803
|
+
|
|
804
|
+
**Solution:**
|
|
805
|
+
```bash
|
|
806
|
+
# Validate JSON before using
|
|
807
|
+
$ echo '{
|
|
808
|
+
"match": "all",
|
|
809
|
+
"rules": [
|
|
810
|
+
{"field": "status", "operator": "equals", "value": "subscribed"}
|
|
811
|
+
]
|
|
812
|
+
}' | jq .
|
|
813
|
+
|
|
814
|
+
# If valid, use in command
|
|
815
|
+
$ cakemail segments create -n "Test" -c '{"match":"all","rules":[...]}'
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
### Unexpected Segment Size
|
|
819
|
+
|
|
820
|
+
Contacts may meet conditions you didn't anticipate.
|
|
821
|
+
|
|
822
|
+
**Solution:**
|
|
823
|
+
```bash
|
|
824
|
+
# Preview contacts in segment
|
|
825
|
+
$ cakemail segments contacts 456 -l 50
|
|
826
|
+
|
|
827
|
+
# Export for analysis
|
|
828
|
+
$ cakemail segments contacts 456 -f json > review.json
|
|
829
|
+
|
|
830
|
+
# Check specific contacts
|
|
831
|
+
$ jq '.data[] | {email, status, last_open_date}' review.json
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
### Custom Attribute Not Working
|
|
835
|
+
|
|
836
|
+
Field name may be incorrect or attribute doesn't exist.
|
|
837
|
+
|
|
838
|
+
**Solution:**
|
|
839
|
+
```bash
|
|
840
|
+
# List contact to see available attributes
|
|
841
|
+
$ cakemail contacts get 123 501 -f json | jq '.custom_attributes'
|
|
842
|
+
|
|
843
|
+
# Use correct field name with dot notation
|
|
844
|
+
$ cakemail segments create -n "Test" \
|
|
845
|
+
-c '{
|
|
846
|
+
"match": "all",
|
|
847
|
+
"rules": [
|
|
848
|
+
{"field": "custom_attributes.plan", "operator": "equals", "value": "premium"}
|
|
849
|
+
]
|
|
850
|
+
}'
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
### Segment Updates Not Reflecting
|
|
854
|
+
|
|
855
|
+
Contact data may not have changed or cache issue.
|
|
856
|
+
|
|
857
|
+
**Solution:**
|
|
858
|
+
```bash
|
|
859
|
+
# Force refresh by re-fetching
|
|
860
|
+
$ cakemail segments get 456
|
|
861
|
+
|
|
862
|
+
# Check specific contacts
|
|
863
|
+
$ cakemail segments contacts 456 -l 10
|
|
864
|
+
|
|
865
|
+
# Verify contact data
|
|
866
|
+
$ cakemail contacts get 123 501 -f json | jq '{last_open_date, status}'
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### Date Comparison Not Working
|
|
870
|
+
|
|
871
|
+
Date format may be incorrect.
|
|
872
|
+
|
|
873
|
+
**Solution:**
|
|
874
|
+
```bash
|
|
875
|
+
# Use ISO date format (YYYY-MM-DD)
|
|
876
|
+
$ cakemail segments create -n "Recent Opens" \
|
|
877
|
+
-c '{
|
|
878
|
+
"match": "all",
|
|
879
|
+
"rules": [
|
|
880
|
+
{"field": "last_open_date", "operator": "greater_than", "value": "2024-03-01"}
|
|
881
|
+
]
|
|
882
|
+
}'
|
|
883
|
+
|
|
884
|
+
# Avoid formats like: "03/01/2024" or "March 1, 2024"
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
**Related Documentation:**
|
|
890
|
+
- [Lists Commands](/en/cli/command-reference/lists/) - Manage contact lists
|
|
891
|
+
- [Contacts Commands](/en/cli/command-reference/contacts/) - Manage contacts
|
|
892
|
+
- [Campaigns Commands](/en/cli/command-reference/campaigns/) - Send campaigns to segments
|
|
893
|
+
- [Attributes Commands](/en/cli/command-reference/attributes/) - Custom contact attributes
|
|
894
|
+
- [Interests Commands](/en/cli/command-reference/interests/) - List-specific interests
|