SPC Retail — Slack + LLM Tool Scoping

Date: 2026-04-09 Context: Scoping a read-only Slack interface into the client's WooCommerce data, with an LLM layer for natural language queries and automated monthly reports.


The Question

Can we turn the WordPress/WooCommerce database into an API (or MCP) accessible via Slack, with controlled read-only commands like:

Short answer: Yes. Straightforward.


Phase 1 — Read-Only Data Access

1. Expose data from WordPress (read-only)

Use the built-in WP REST API + WooCommerce REST endpoints, or create custom endpoints for exactly what you want:

add_action('rest_api_init', function () {
  register_rest_route('gm/v1', '/sales-summary', [
    'methods' => 'GET',
    'callback' => 'gm_get_sales_summary',
    'permission_callback' => function () {
      return current_user_can('read'); // or custom auth
    }
  ]);
});

function gm_get_sales_summary($request) {
  // query Woo orders + return totals
}

Lock it down with: - Application Passwords (basic auth) - JWT / token header - IP allowlist (if internal)

2. Thin middleware layer

Don't hit WP directly from Slack. Use a Node/Express or serverless middleware that: - Calls the WP API - Formats responses - Handles auth + rate limiting

3. Slack interface (2 options)

Option A — Slash commands (simplest)

/sales last-30-days
/top-products

Slack → middleware → WP → response

Option B — Slack bot (better UX) - Uses Events API + LLM parsing - "show me top selling products this month" - Maps intent → endpoint

4. MCP (optional)

Wrap the same endpoints as MCP tools. Then Slack bot (or Claude/OpenAI agent) calls tools instead of hardcoded routes. Overkill unless you want agent interoperability.

Data we can expose easily

Query Source
Top selling products wc_get_products + order stats
Sales by date wp_posts + wc_order_stats
Featured products product meta _featured = yes

Baseline architecture

Slack → (slash/bot)
   → Middleware (Node)
      → WP REST / Woo API (read-only endpoints)
         → Response → Slack

Key callouts

Baseline build: ~1–2 days.


Phase 2 — Add LLM + Automation

Architecture (tight version)

Slack (bot)
  → LLM (intent parser)
    → Tool layer (your endpoints)
      → WP / Woo API
  → Response formatter
  → Slack

1. Hybrid input model

Predefined commands (fast + reliable)

/sales 30d
/sales mtd
/top-products

Natural language (LLM parses → structured call) - "show me sales last month vs last year" - "top 5 products this quarter"

The LLM's job is NOT to fetch data. It only maps input → { intent, params }.

Example output:

{
  "intent": "sales_summary",
  "range": "last_month",
  "compare": "last_year"
}

2. Tool layer (this is the real product)

Keep it tight. 5–8 endpoints max:

Return clean JSON. No fluff.

3. LLM wiring (important constraint)

Do NOT let the LLM query WP directly. Instead: - Give it a fixed tool schema - It picks the tool - Your backend executes it

Patterns: - OpenAI → function calling - Anthropic → tool use - OpenRouter → same pattern

4. Slack bot flow

  1. User message
  2. Send to LLM with tool definitions
  3. LLM returns tool call
  4. Execute tool
  5. Send formatted result back

5. Scheduled reports (easy win)

Cron job (or serverless scheduler) posts a monthly report to Slack:

Example payload:

📊 March Sales Report

Revenue: $82,430 (+12% vs Feb, +18% YoY)

Top Products:
1. Product A — $12,300
2. Product B — $9,800
...

Notes:
• Strong growth in category X
• Decline in Y (−8%)

6. Where the LLM actually adds value

7. Guardrails (don't skip)

8. Optional upgrades (later)


TL;DR

If the LLM disappears, the system should still work with slash commands. That's how you know it's built right.