@flowapt/flowiq-cli 0.2.7 → 0.2.9

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/README.md CHANGED
@@ -552,13 +552,25 @@ Set an allowlisted set of the active agent's config fields (the prompt-builder
552
552
  flowiq agent config <organization_id> # show current
553
553
  flowiq agent config <organization_id> --use-settings-prompt --model gpt-5.4-mini \
554
554
  --rename Zara --tool woo_order_build=true --tool view_cart_tool=true --discount true
555
+ flowiq agent config <organization_id> --test-contact-number 27000000001 --test-contact-name "QA Bot"
555
556
  ```
556
557
 
557
558
  Settable: `settings.use_settings_prompt`, `settings.model`, agent `--rename`,
558
559
  the tool-flag columns (`woo_order_build`, `woo_tip_field`, `woo_order_note_field`,
559
560
  `view_cart_tool`, `restock_tool`, `block_tool_status`, `postal_code_tool_status`,
560
- `shopify_products_web_chat`), and `discount.enabled`. Anything else is rejected;
561
- every change is reported before → after.
561
+ `shopify_products_web_chat`), `discount.enabled`, and the `flowiq test` contact
562
+ (`settings.test_contact_number` / `settings.test_contact_name`). Anything else is
563
+ rejected; every change is reported before → after.
564
+
565
+ **Test contact (`--test-contact-number` / `--test-contact-name`, v0.2.9).**
566
+ This is the contact `flowiq test` drives the live agent through (read by
567
+ `api/cli/agent-test.js` as `settings.test_contact_number`). ⚠ **Use a clearly
568
+ FAKE number.** Whatever you set becomes the `whatsapp_id` the test harness looks
569
+ up or creates in the org — point it at a real customer's number and your tests
570
+ route through *their* contact record and force `bot_status=true` on it. If that
571
+ number already maps to an existing contact, the command prints a `⚠` warning
572
+ naming it. Pass `--test-contact-number ""` (empty) to clear the override — the
573
+ harness then falls back to a synthetic per-agent `test_<agent_id>` contact.
562
574
 
563
575
  ### Agent updates — `flowiq agent-updates pull|list|resolve` (alias `au`)
564
576
 
package/TEAM-GUIDE.md CHANGED
@@ -75,6 +75,7 @@ you have installed.
75
75
  | See an org's agents / create one | `flowiq agent list <org_id>` / `flowiq agent create <org_id> --name "…"` |
76
76
  | Change agent model / tool flags | `flowiq agent config <org_id> --model … --tool view_cart_tool=true` |
77
77
  | Talk to the live agent safely (no real WhatsApp ever sent) | `flowiq test send <org_id> "hi, do you sell X?"` |
78
+ | Set which contact `flowiq test` uses (use a FAKE number!) | `flowiq agent config <org_id> --test-contact-number 27000000001 --test-contact-name "QA Bot"` |
78
79
  | Send a template broadcast to a CSV of people | `flowiq bc map <org_id> --template … --csv …` → `flowiq bc send … ` (dry-run) → `… --commit` |
79
80
  | Tag every repeat buyer (e.g. 2+ orders in the last 60 days) | `flowiq seg plan <org_id> --tag-prefix repeat-60d --min-orders 2 --window 60d` → `flowiq seg apply <org_id> repeat-60d` (dry run) → `… --commit` |
80
81
  | Tag everyone who bought a product (accurate, windowable) | `flowiq seg plan <org_id> --tag-prefix whey --bought "Whey" --window 90d` → `flowiq seg apply … --commit` |
@@ -122,6 +123,43 @@ Custom tools define real HTTP calls the agent can execute, so the server
122
123
  validates hard (names, URLs, methods, parameter shapes) and warns about typo'd
123
124
  keys or `{{placeholders}}` it doesn't recognise. Take the warnings seriously.
124
125
 
126
+ ### Example: tag a segment of contacts (Advanced Tagging)
127
+
128
+ `flowiq tag` is the Contacts → **Advanced Tagging** dialog in your terminal.
129
+ It applies **one named tag** to a matched set. It is **always dry-run first** —
130
+ you see the count and a sample, and *nothing writes* until you add `--commit`.
131
+
132
+ ```bash
133
+ # 1. See who matches (nothing is written)
134
+ flowiq tag segment <org_id> --min-orders 2 --min-spent 1000 --region ZA-GP
135
+ # → "Custom segment: 4502 contact(s) match." + a 10-row sample
136
+
137
+ # 2. Happy with the count? Apply the tag:
138
+ flowiq tag segment <org_id> --min-orders 2 --min-spent 1000 --region ZA-GP \
139
+ --tag gp-repeat-spenders --commit
140
+ # → "matched 4502 · newly tagged 4502 · already had ... 0"
141
+
142
+ # 3. Verify, then (if needed) undo:
143
+ flowiq tag list <org_id> --prefix gp-repeat # tag → count
144
+ flowiq tag remove <org_id> gp-repeat-spenders --confirm # removes it from everyone
145
+ ```
146
+
147
+ The five match modes (swap `segment` for any of these):
148
+
149
+ | Mode | Tags contacts who… |
150
+ |---|---|
151
+ | `field --field order_history --any "Whey,Protein"` | have a keyword in a field (order history, summary, shopify tags, name, email…) |
152
+ | `cohort --type top_spenders --limit 500` | rank in the **top N** by spend / orders / recency (top-N, not a threshold) |
153
+ | `segment --min-orders 2 --min-spent 1000 --region ZA-GP` | match order-count / spend / last-order-date / region filters |
154
+ | `attributes --filter allow_broadcast_true` | match a broadcast-permission state |
155
+ | `messages --min-count 3 --sender user-whatsapp` | have ≥ N messages of a channel type |
156
+
157
+ Two things to know: for **"who bought product X"** use
158
+ `flowiq seg plan --bought "X" --window 90d` instead of `tag field` — it reads the
159
+ real order line-items (accurate + windowable) rather than the order-history text.
160
+ And a commit over 2000 contacts asks you to type the tag name to confirm
161
+ (add `--yes` to skip). Everything is appends-only and reversible with `tag remove`.
162
+
125
163
  ## Keys, rotation, logging out
126
164
 
127
165
  - **`flowiq auth refresh`** — rotates this device's key in place (a fresh key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowapt/flowiq-cli",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Command-line tool for FlowIQ staff: round-trip agent prompts, questionnaires, fine-tuning, pin-board tasks, webhooks, templates, agent-updates, chat exports, and live agent testing without ever touching service-role credentials.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,6 +41,8 @@ export async function config(orgId, opts = {}) {
41
41
  const settings = {};
42
42
  if (opts.useSettingsPrompt !== undefined) settings.use_settings_prompt = parseBool(opts.useSettingsPrompt, "--use-settings-prompt");
43
43
  if (opts.model !== undefined) settings.model = opts.model;
44
+ if (opts.testContactNumber !== undefined) settings.test_contact_number = opts.testContactNumber;
45
+ if (opts.testContactName !== undefined) settings.test_contact_name = opts.testContactName;
44
46
  if (Object.keys(settings).length) body.settings = settings;
45
47
  if (opts.rename !== undefined) body.name = opts.rename;
46
48
  if (opts.discount !== undefined) body.discount_enabled = parseBool(opts.discount, "--discount");
@@ -73,7 +75,7 @@ export async function config(orgId, opts = {}) {
73
75
  }
74
76
  console.log(`${resp.organization_name} → agent ${resp.agent_id}${resp.is_active === false ? " [NON-active]" : ""}`);
75
77
  printSnapshot("current", resp.current);
76
- console.log("\n(pass --use-settings-prompt / --model / --rename / --tool / --discount to change)");
78
+ console.log("\n(pass --use-settings-prompt / --model / --rename / --tool / --discount / --test-contact-number / --test-contact-name to change)");
77
79
  return;
78
80
  }
79
81
 
@@ -93,4 +95,5 @@ export async function config(orgId, opts = {}) {
93
95
  const a = resp.after?.[k];
94
96
  console.log(` ${k.padEnd(30)} ${b === null || b === undefined ? "(unset)" : b} → ${a === null || a === undefined ? "(unset)" : a}`);
95
97
  }
98
+ for (const w of resp.warnings || []) console.log(` ⚠ ${w}`);
96
99
  }
package/src/index.js CHANGED
@@ -227,6 +227,8 @@ export function run(argv) {
227
227
  .option("--rename <name>", "rename the agent")
228
228
  .option("--tool <flag=bool>", "toggle a tool flag (repeatable): woo_order_build/woo_tip_field/woo_order_note_field/view_cart_tool/restock_tool/block_tool_status/postal_code_tool_status/shopify_products_web_chat", agentConfigCmd.collectTool, [])
229
229
  .option("--discount [bool]", "agent.discount.enabled (true if bare)")
230
+ .option("--test-contact-number <number>", "settings.test_contact_number — the contact `flowiq test` uses (use a FAKE number; \"\" clears it → synthetic fallback)")
231
+ .option("--test-contact-name <name>", "settings.test_contact_name — display name for the test contact (\"\" clears it)")
230
232
  .action((orgId, opts) => agentConfigCmd.config(orgId, opts));
231
233
 
232
234
  // agent-updates (pending client change-requests + chat context; pull + resolve)