Skip to content

Add AI auto-responder, flow builder, contacts, ecommerce webhook - #49

Closed
Jbelieve wants to merge 2 commits into
diwenne:mainfrom
BELIEVE-IT-GROUP:feature/ai-flow-ecommerce
Closed

Add AI auto-responder, flow builder, contacts, ecommerce webhook#49
Jbelieve wants to merge 2 commits into
diwenne:mainfrom
BELIEVE-IT-GROUP:feature/ai-flow-ecommerce

Conversation

@Jbelieve

@Jbelieve Jbelieve commented Sep 5, 2026

Copy link
Copy Markdown

Summary

  • AI auto-responder per campaign (Claude, tool-use structured output, deterministic opt-out, always escalates instead of guessing on failure)
  • Visual flow builder (xyflow, ported from Maasy's WhatsApp flow pattern) — condition/send_dm/add_tag/ai_reply nodes
  • Contacts + freeform tags, populated as messages come in
  • Inbound ecommerce webhook (BeCommerce/Medusa order events), HMAC-verified, log-only for now (no email→Instagram linkage exists yet)
  • All additive: legacy keyword→dmMessage campaigns are byte-for-byte unchanged when neither aiEnabled nor a flow is configured

Test plan

  • npx tsc --noEmit clean
  • npm run build clean (all new routes present)
  • npx vitest run — 191/191 passing (17 files)
  • Migration verified additive-only against a fresh local Postgres (migrate diff + migrate deploy)
  • Smoke test on reply.believe-global.com after deploy (real campaign, real Instagram account)

Approved by Jorge for merge + deploy.

🤖 Generated with Claude Code

Jbelieve and others added 2 commits September 5, 2026 02:54
- Believe Blue accent + BrandMark wordmark (Be cyan, Reply blue, cyan dot)
  in sidebar, login, verify-request, invite pages
- Sidebar recolored to Believe Blue 950 with negative wordmark variant
- Root page now redirects to /dashboard or /login instead of the OSS
  marketing landing
- Favicon/app icons generated natively via next/og ImageResponse,
  replacing static PNGs
- docker-compose.prod.yml for self-hosted deploy (web+worker+cron+
  postgres+redis behind Coolify/Traefik), secrets sourced from .env

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Four modules built in parallel (Sonnet: AI/contacts/webhook, Opus: flow
builder), then wired together into the existing DM worker without
touching the plain keyword->dmMessage path for campaigns that use
neither feature.

- lib/ai/responder.ts: Claude-backed auto-responder, tool-use structured
  output ({reply, escalate, reason}), deterministic opt-out regex ahead
  of the model call, 15s hard timeout, never throws.
- lib/flow/engine.ts + components/flow-builder/*: visual trigger->action
  canvas (@xyflow/react, ported from Maasy's WhatsAppFlowBuilder pattern)
  for condition/send_dm/add_tag/ai_reply nodes. Pure engine, no I/O.
- lib/contacts.ts + app/(dashboard)/contacts: per-workspace Contact
  model with freeform tags, populated as messages come in.
- app/api/webhooks/ecommerce: HMAC-verified inbound webhook for
  BeCommerce/Medusa order events, mirroring the existing
  pushOrderToMaasyCrm subscriber pattern. Logs only for now — no
  Contact matching, since there is no real link between a BeCommerce
  order email and an Instagram igUserId yet.
- dm-worker.ts: aiEnabled/flow campaigns resolve a smart reply after
  the follow gate clears; escalation releases the DM reservation and
  logs SKIPPED_ESCALATED (new DmStatus value) instead of guessing.
- Migration is additive only: new nullable columns, one new table, one
  new enum value. Verified against a fresh local Postgres via
  migrate diff + migrate deploy before touching production.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 5, 2026

Copy link
Copy Markdown

@Jbelieve is attempting to deploy a commit to the diwenne's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Jbelieve

Jbelieve commented Sep 5, 2026

Copy link
Copy Markdown
Author

Closing — opened by mistake against the wrong base repo (internal fork PR, not meant for upstream). Apologies for the noise.

@Jbelieve Jbelieve closed this Sep 5, 2026
@Jbelieve
Jbelieve deleted the feature/ai-flow-ecommerce branch September 5, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant