diff --git a/delay-list-skill/SKILL.md b/delay-list-skill/SKILL.md index 4f7cf3e..134a35c 100644 --- a/delay-list-skill/SKILL.md +++ b/delay-list-skill/SKILL.md @@ -184,6 +184,75 @@ Send each part as a separate call to `mcp__traffic-mcp__Call_slack-feed-traffic- **Confidence:** If ALL criteria match exactly → auto-execute (99%+ confidence). If any field is ambiguous or missing → MANUAL\_REVIEW. --- +--- + +## Step 3: Supplier Outreach — "In Production" Past Dispatch + +### Criteria + +- Dispatch date has passed +- State = `Your order is in production` OR `Ready for production` +- No tracking information + +### Pre-check (if HubSpot integration available) + +Check HubSpot for existing communication on the order item using the **mandatory 3-step search** below. Then categorize each order: + +- **If email found explaining delay WITH reason** → print reason in chat with order, skip outreach email +- **If email found but NO reason provided** → print new dispatch date in chat with order_id, add order to markdownfile per supplier. +- **If email shows internal issue** (e.g., artwork, stock) → tell which orders are internal reason. +- **If no email found** → add order information to markdown file + +### HubSpot Search Strategy (MANDATORY — execute ALL 3 steps) + +The `hp_order_line_id` and `hp_order_id` fields in HubSpot frequently contain **multiple comma-separated values** in a single field (e.g., `"9155560, 9162986"`). IN/EQ filters only match when the field contains exactly one value, so they **will miss** multi-value fields. All 3 steps below are required — skipping step 3 consistently causes 10-20% of tickets to be missed. + +**Step 1 — Batch IN-filter on `hp_order_line_id`** +Search tickets using `IN` operator on `hp_order_line_id` with batches of max 50 detail IDs. Record which detail IDs got a hit. + +**Step 2 — Batch IN-filter on `hp_order_id`** +For all orders where NO hit was found in step 1: search tickets using `IN` operator on `hp_order_id` with batches of max 50 order IDs. Record which orders got a hit. + +**Step 3 — Individual full-text `query` search (DO NOT SKIP)** +For every detail ID that STILL has no hit after steps 1 and 2: search tickets using the `query` parameter (not a filter) with the individual detail ID as search string. This finds tickets where the ID is embedded in a multi-value field. Do this for every remaining `id_order_detail`. If that returns 0, also try the `id_order`. + +> **Why this matters:** In practice, ~15% of HubSpot tickets use multi-value fields. Without step 3, you will miss existing supplier communication and send unnecessary outreach emails for orders that already have a known status. + +### Supplier-Specific Handling + +Before creating generic outreach emails, check if the supplier has a specific workflow: + +#### Probo +- **False delay check (automated):** Probo orders often trigger false delays when multiple order lines are shipped together. Check Presta for linked order lines: + 1. Gather all linked order lines for the order + 2. Check the "despatch" tab on all order lines + 3. If lines were shipped together → remove from delay list (false delay) +- **Portal status check (manual):** The Probo portal is not accessible to the AI. List all remaining Probo delayed orders (after false-delay filtering) in a separate "Manual Action Required — Probo" section so the operator can verify actual production status in the Probo portal. +- **Probo delay email received in HubSpot** → Flag these orders: update to "not sent on time", note the need to follow up for a new dispatch date. +- **Outreach:** Do NOT include Probo orders in the generic supplier email drafts. All Probo follow-up is handled via their portal or based on portal findings. + +#### Flyeralarm +- **Any delay** → Do NOT send an outreach email and do NOT include in the supplier email drafts. Flyeralarm delays are handled via their own supplier portal (case creation), which requires manual access. +- **Action:** List all Flyeralarm delayed orders in a separate "Manual Action Required — Flyeralarm" section in the output so the operator can handle them in the portal. + +#### Masterprint +- **Skip entirely** — Masterprint tracking is already automated. Orders packaged on the Masterprint tracking sheet are auto-removed from the delay list. No outreach needed. + +### Action + +For all **remaining suppliers** (not covered by supplier-specific handling above), create drafts in a markdown file with emails per supplier so we can review them. + +> **CRITICAL RULE:** Bundle emails per supplier. Never create multiple emails to the same supplier. Group all delayed order lines for a supplier into ONE email in the markdown file. + +The email should include: + +- All affected order IDs and order detail IDs +- Target dispatch dates +- Product +- Supplier Order +- Carrier + + ## **Logging & Tracking**