@cowliss/cli 0.5.0 → 0.7.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.
@@ -6,13 +6,20 @@ import { defineJourney } from "@cowliss/cli/journeys";
6
6
  * recovered, a trait your segments and other journeys can read. Silence
7
7
  * spends exactly one reminder email and closes.
8
8
  *
9
+ * `marketing` and no `enrollment`, so one shopper goes through this once,
10
+ * ever: their second abandoned cart is not nagged about. Add
11
+ * `enrollment: { cooldown: "30d" }` to reach a repeat abandoner again, a
12
+ * month after their last reminder.
13
+ *
9
14
  * Example: add it with `cow add example abandoned-checkout`; rename the
10
15
  * events and the email to your domain's vocabulary.
11
16
  */
12
17
  export default defineJourney({
13
18
  trigger: { event: "checkout_started" },
14
- purpose: "emailMarketing",
15
- senderIdentity: "cowliss-default",
19
+ purpose: "marketing",
20
+ from: "Acme <checkout@example.com>",
21
+ description:
22
+ "Reminds someone who left items in their cart, and stops if they buy.",
16
23
  tags: ["demo", "checkout"],
17
24
  run: async (event, api) => {
18
25
  const purchased = await api.waitForEvent("purchase_completed", {
@@ -9,8 +9,7 @@
9
9
  "activity": "sendEmail",
10
10
  "input": {
11
11
  "template": "abandoned-checkout",
12
- "props": { "firstName": "Ada" },
13
- "senderIdentity": "cowliss-default"
12
+ "props": { "firstName": "Ada" }
14
13
  }
15
14
  }
16
15
  ]
@@ -6,7 +6,15 @@ import { defineJourney } from "@cowliss/cli/journeys";
6
6
  * later event restarts the execution, which resets the 30-day silence clock
7
7
  * with a fresh, empty journal; 30 days of silence unsets the flag (removed,
8
8
  * not set to false, so `exists` predicates stop matching) and the execution
9
- * completes. The next event starts a new one.
9
+ * completes.
10
+ *
11
+ * Restarting is not finishing, so a user who keeps showing up never counts
12
+ * as having been through this journey and the loop runs for as long as they
13
+ * do. The execution that ends after 30 days of silence does count, and with
14
+ * `marketing` and no `enrollment` that is the end of it: their next event
15
+ * does not re-flag them. A journey meant to track state for the life of an
16
+ * account wants to reopen as soon as it closes, which is what
17
+ * `enrollment: { cooldown: "1s" }` says.
10
18
  *
11
19
  * `"*"` is activity as it really arrives: whatever names your apps send,
12
20
  * page_view and purchase and login alike. It never matches an event Cowliss
@@ -20,8 +28,10 @@ import { defineJourney } from "@cowliss/cli/journeys";
20
28
  */
21
29
  export default defineJourney({
22
30
  trigger: { event: "*" },
23
- purpose: "emailMarketing",
24
- senderIdentity: "cowliss-default",
31
+ purpose: "marketing",
32
+ from: "Acme <hello@example.com>",
33
+ description:
34
+ "Keeps track of whether someone has been active in the last 30 days.",
25
35
  tags: ["demo", "retention"],
26
36
  run: async (_event, api) => {
27
37
  await api.traits.set("active_30d", true);
@@ -7,16 +7,21 @@ import { defineJourney } from "@cowliss/cli/journeys";
7
7
  * users still on the free plan. This is the portfolio-operator pattern: one
8
8
  * org's journeys reacting across its own apps.
9
9
  *
10
+ * `marketing` and no `enrollment`: one pitch per person, however often they
11
+ * change plan. A pitch is worth making once.
12
+ *
10
13
  * Example: add it with `cow add example cross-app-pitch`; rename the app id,
11
14
  * the event, and the email to your own.
12
15
  */
13
16
  export default defineJourney({
14
17
  trigger: { event: "plan_upgraded", appId: "app_b" },
15
- purpose: "emailMarketing",
16
- // A named identity rather than the default: a pitch for your other product
17
- // reads better from a product address than from the one your receipts come
18
- // from. Create it under Settings, Domains, sender identities.
19
- senderIdentity: "product-news",
18
+ purpose: "marketing",
19
+ description:
20
+ "Tells someone who just upgraded about the other product they can use.",
21
+ // An address of its own rather than the shared one: a pitch for your other
22
+ // product reads better from a product address than from the one your
23
+ // receipts come from. Verify its domain under Settings, Domains first.
24
+ from: "Product News <product-news@example.com>",
20
25
  tags: ["demo", "cross-app"],
21
26
  run: async (_event, api) => {
22
27
  await api.sleep("1d");
@@ -10,7 +10,7 @@
10
10
  "input": {
11
11
  "template": "cross-app-pitch",
12
12
  "props": { "plan": "pro" },
13
- "senderIdentity": "product-news"
13
+ "from": "Product News <product-news@example.com>"
14
14
  }
15
15
  }
16
16
  ]
@@ -4,15 +4,22 @@ import { defineJourney } from "@cowliss/cli/journeys";
4
4
  * Winback: `purchase_completed` starts (or restarts) an execution and marks
5
5
  * the profile as having bought recently; every further purchase inside 30
6
6
  * days resets the silence clock; after 30 days of silence the flag is unset
7
- * and one winback email goes out. The next purchase starts a fresh execution.
7
+ * and one winback email goes out.
8
+ *
9
+ * `marketing` and no `enrollment`, so each customer is won back once, ever:
10
+ * the purchase that answers the email does not start a second execution.
11
+ * That is the safe default for a mail nobody asked for. To win the same
12
+ * customer back every time they lapse, say how long to leave between
13
+ * attempts: `enrollment: { cooldown: "180d" }`.
8
14
  *
9
15
  * Example: add it with `cow add example winback`; rename the purchase event,
10
16
  * the flag trait, and the email to your domain's vocabulary.
11
17
  */
12
18
  export default defineJourney({
13
19
  trigger: { event: "purchase_completed" },
14
- purpose: "emailMarketing",
15
- senderIdentity: "cowliss-default",
20
+ purpose: "marketing",
21
+ from: "Acme <hello@example.com>",
22
+ description: "Invites a customer back after 30 days without a purchase.",
16
23
  tags: ["demo", "retention"],
17
24
  run: async (_event, api) => {
18
25
  await api.traits.set("purchased_recently", true);
@@ -15,7 +15,7 @@
15
15
  { "activity": "unsetTrait", "input": { "key": "purchased_recently" } },
16
16
  {
17
17
  "activity": "sendEmail",
18
- "input": { "template": "winback", "senderIdentity": "cowliss-default" }
18
+ "input": { "template": "winback" }
19
19
  }
20
20
  ]
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowliss/cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "cow": "./dist/index.js"