Skip to content

add D2C Reorder Nudge Agent for subscription-free retention#104

Open
bhavya-ops21 wants to merge 2 commits intoLamatic:mainfrom
bhavya-ops21:main
Open

add D2C Reorder Nudge Agent for subscription-free retention#104
bhavya-ops21 wants to merge 2 commits intoLamatic:mainfrom
bhavya-ops21:main

Conversation

@bhavya-ops21
Copy link
Copy Markdown

@bhavya-ops21 bhavya-ops21 commented Mar 25, 2026

Description

This PR adds the D2C Reorder Nudge Agent, built for A_Mowglies .

The agent solves a major pain point for repeat-purchase D2C brands: Revenue leakage due to forgotten reorders. It automates the calculation of a customer's "stock-out" date and generates a personalized WhatsApp/SMS nudge without requiring a subscription model.

Features

  • Stock-Out Logic: Custom JavaScript node calculates exact replenishment dates based on purchase_date and daily_usage.
  • Personalized Outreach: Uses LLM (Gemini) to craft friendly, brand-aligned reorder reminders.
  • API Ready: Returns structured JSON (message, reorder date, days remaining) for easy integration with marketing tools like Klaviyo or WhatsApp APIs.

Tech Stack

  • Framework: Lamatic.ai
  • Model: Google Gemini 2.5 Flash
  • Logic: JavaScript (Date manipulation)

Changes

  • Created d2c-reorder-nudge example folder.
  • Included agent.json workflow configuration.
  • Added comprehensive README with sample Input/Output schemas.

Verification

  • Tested with sample D2C purchase data.
  • Verified date calculation logic handles month-end rollovers correctly.
  • Added new kits/automation/reorder-nudge-agent/ kit with documentation
  • Introduces D2C Reorder Nudge Agent for A_Mowglies brand
  • Automates reorder reminders by calculating customer stock-out date based on purchase history and daily usage
  • Flow: API → JavaScript date calculation → Gemini 2.5 Flash LLM nudge generation → structured JSON response
  • Output includes personalized message, reorder date, and days remaining
  • Targets D2C repeat-purchase brands (disposables, supplements, skincare, etc.)
  • Tech stack: Lamatic.ai framework, Google Gemini 2.5 Flash, JavaScript

Added README for the D2C Reorder Nudge Agent detailing its functionality, input/output formats, and technologies used.
Add README for D2C Reorder Nudge Agent
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

A new README document has been added to the reorder-nudge-agent kit that documents the D2C Reorder Nudge Agent's purpose, operational flow, API request/response schemas, implementation technologies, and usage examples.

Changes

Cohort / File(s) Summary
New Documentation
kits/automation/reorder-nudge-agent/README.md
Added README describing the D2C Reorder Nudge Agent, including problem context, step-by-step flow (API request → date calculation → LLM nudge generation → response), JSON input/output schemas, implementation stack (Lamatic.ai, Google Gemini 2.5 Flash, JavaScript), concrete request/response examples, and general applicability notes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main addition to the codebase—a D2C Reorder Nudge Agent designed for retention without subscription requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
kits/automation/reorder-nudge-agent/README.md (1)

27-33: Use a stable machine-readable date format in API output.

reorder_date is shown as "Mon Mar 31 2026" while input uses ISO (YYYY-MM-DD). Consider returning ISO-8601 for downstream automation consistency.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5c075adc-0437-4551-86e2-561470b5c897

📥 Commits

Reviewing files that changed from the base of the PR and between 4e2f140 and b0c29ac.

📒 Files selected for processing (1)
  • kits/automation/reorder-nudge-agent/README.md

Comment on lines +1 to +42
# 🔁 D2C Reorder Nudge Agent

**Built for A_Mowglies** — a pre-launch D2C disposable underwear brand.

## Problem Statement
D2C brands selling consumable/repeat-purchase products lose revenue when customers forget to reorder. There's no automated way to calculate when a customer will run out and send a personalized nudge — without a human in the loop.

## What This Agent Does
1. Takes customer purchase data as input (name, purchase date, quantity, daily usage)
2. Calculates exactly when they'll run out of stock
3. Generates a personalized WhatsApp reorder nudge via LLM
4. Returns the message + reorder date instantly via API

## Flow
API Request → Code (calculates restock date) → Generate Text (LLM nudge) → API Response

## Input
```json
{
"customer_name": "Priya",
"purchase_date": "2026-03-01",
"quantity": 30,
"daily_usage": 1
}
```

## Output
```json
{
"message": "Hey Priya! Just a friendly reminder...",
"reorder_date": "Mon Mar 31 2026",
"days_remaining": 6
}
```

## Built With
- Lamatic.ai (flow builder + deployment)
- Google Gemini 2.5 Flash
- JavaScript (date calculation logic)

## Use Case
Applicable to any high-repeat-purchase D2C brand — disposables, supplements, pet food, skincare etc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add missing Setup and Environment Variables sections.

This README explains flow and I/O, but it does not document installation/setup steps or required env vars, which makes kit onboarding incomplete.

📌 Suggested README patch
 # 🔁 D2C Reorder Nudge Agent
@@
 ## Flow
 API Request → Code (calculates restock date) → Generate Text (LLM nudge) → API Response
+
+## Setup
+1. Import this kit into your Lamatic workspace.
+2. Configure the `agent.json` workflow in your project.
+3. Connect your outbound channel integration (e.g., WhatsApp/SMS provider, Klaviyo).
+4. Test with sample payloads from the **Input** section below.
+
+## Environment Variables
+Document and configure the required secrets before deployment:
+
+```bash
+GEMINI_API_KEY=<your_google_ai_api_key>
+LAMATIC_API_KEY=<your_lamatic_api_key_if_required>
+WHATSAPP_API_TOKEN=<token_if_whatsapp_delivery_is_enabled>
+KLAVIYO_API_KEY=<key_if_klaviyo_sync_is_enabled>
+```
+
+> Keep only the variables your workflow actually uses, and remove unused entries.

As per coding guidelines, kits/**/README.md: Every kit must have a README.md that documents setup, environment variables, and usage.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 🔁 D2C Reorder Nudge Agent
**Built for A_Mowglies** — a pre-launch D2C disposable underwear brand.
## Problem Statement
D2C brands selling consumable/repeat-purchase products lose revenue when customers forget to reorder. There's no automated way to calculate when a customer will run out and send a personalized nudge — without a human in the loop.
## What This Agent Does
1. Takes customer purchase data as input (name, purchase date, quantity, daily usage)
2. Calculates exactly when they'll run out of stock
3. Generates a personalized WhatsApp reorder nudge via LLM
4. Returns the message + reorder date instantly via API
## Flow
API Request → Code (calculates restock date) → Generate Text (LLM nudge) → API Response
## Input
```json
{
"customer_name": "Priya",
"purchase_date": "2026-03-01",
"quantity": 30,
"daily_usage": 1
}
```
## Output
```json
{
"message": "Hey Priya! Just a friendly reminder...",
"reorder_date": "Mon Mar 31 2026",
"days_remaining": 6
}
```
## Built With
- Lamatic.ai (flow builder + deployment)
- Google Gemini 2.5 Flash
- JavaScript (date calculation logic)
## Use Case
Applicable to any high-repeat-purchase D2C brand — disposables, supplements, pet food, skincare etc.
# 🔁 D2C Reorder Nudge Agent
**Built for A_Mowglies** — a pre-launch D2C disposable underwear brand.
## Problem Statement
D2C brands selling consumable/repeat-purchase products lose revenue when customers forget to reorder. There's no automated way to calculate when a customer will run out and send a personalized nudge — without a human in the loop.
## What This Agent Does
1. Takes customer purchase data as input (name, purchase date, quantity, daily usage)
2. Calculates exactly when they'll run out of stock
3. Generates a personalized WhatsApp reorder nudge via LLM
4. Returns the message + reorder date instantly via API
## Flow
API Request → Code (calculates restock date) → Generate Text (LLM nudge) → API Response
## Setup
1. Import this kit into your Lamatic workspace.
2. Configure the `agent.json` workflow in your project.
3. Connect your outbound channel integration (e.g., WhatsApp/SMS provider, Klaviyo).
4. Test with sample payloads from the **Input** section below.
## Environment Variables
Document and configure the required secrets before deployment:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants