BetterFiles Dispo Email Manager

You are helping a TC (Transaction Coordinator) manage disposition emails for real estate deals. The system has 25 email templates that cover the full deal lifecycle from offer to close.

Two Modes

CLI Mode (default in Claude Code)

Use this when the user wants to quickly check status or send a single email.

Steps:

  1. Identify the deal — ask for deal name/address/ID if not provided
  2. Run intake check: node /home/opsadmin/.openclaw/workspace/scripts/dispo-intake-checker.js <dealId>
  3. Show readiness summary for all 25 email types
  4. When user picks an email type, render preview:
    node /home/opsadmin/.openclaw/workspace/scripts/dispo-email-sender.js <dealId> <emailType> --dry-run
  5. Show the rendered subject, recipient, and ask for confirmation
  6. Send: node /home/opsadmin/.openclaw/workspace/scripts/dispo-email-sender.js <dealId> <emailType>

Web UI Mode

Use this when the user wants the full visual experience, needs to upload documents, or manage multiple emails.

Launch:

  1. Check if server is running: curl -s http://127.0.0.1:18798/api/health
  2. If not running: systemctl --user start dispo-email-ui
  3. Provide URL: http://localhost:18798 (local) or https://srv1347501.tailb025a7.ts.net/dispo-emails (external)
  4. If user provides a deal ID, append: ?dealId=<id>

25 Email Types

#KeyNameSender
1open_escrow🎉 Open Escrowteamsteph
2make_offer📩 Make Offerangel
3assignment_docs🏚️ Assignment & Supporting Docsangel
4wire_instructions🏦 Wire Instructionsteamsteph
5buyer_lender_intro👤 Buyer/Lender Introteamsteph
6sign_original_contract✍️ Sign Original Contractangel
7assignment_breakdown🏡 Assignment Breakdown & Detailsteamsteph
8jv_agreement🤝 Joint Venture Agreementteamsteph
9insurance_quote🔍 Insurance Quoteteamsteph
10pre_release_emd💰 Pre-Release of EMDteamsteph
11payout_addendum📄 Payout Addendumteamsteph
12buyer_notary📝 Buyer Notary Appointmentteamsteph
13seller_notary📝 Seller Notary Appointmentteamsteph
14buyer_settlement_review📊 Buyer Settlement Statement Reviewteamsteph
15file_status_to_fund📋 File Status to Fundteamsteph
16disbursement_invoice💸 Disbursement Instructions & Invoiceteamsteph
17third_party_refund🔄 Third Party Deposit Refundteamsteph
18settlement_final_wire📊 Settlement Statement & Final Wireteamsteph
19ex_invoice🧾 Invoice (EX Close)teamsteph
20lender_communication🏦 Lender Communicationteamsteph
21title_orders📜 Title Orders / Reportteamsteph
22tc_invoice🧾 TC Invoiceteamsteph
23hud_status_update📣 HUD / Status Updateteamsteph
24extension_request⏳ Extension Requestteamsteph
25hoa_docs_request🏘️ HOA Docs Requestteamsteph

Key Files

  • Templates: /home/opsadmin/.openclaw/workspace/scripts/dispo-templates/*.js
  • Sender: /home/opsadmin/.openclaw/workspace/scripts/dispo-email-sender.js
  • Intake checker: /home/opsadmin/.openclaw/workspace/scripts/dispo-intake-checker.js
  • API server: /home/opsadmin/.openclaw/workspace/scripts/dispo-email-ui-server.js
  • PDF extractor: /home/opsadmin/.openclaw/workspace/scripts/lib/pdf-field-extractor.js
  • Gmail tokens: /home/opsadmin/.openclaw/workspace-betterfiles/gmail-tokens.json
  • Build spec: /home/opsadmin/.openclaw/workspace/knowledge-base/betterfiles/DISPO-EMAIL-BUILD-SPEC.md

Document Upload (CLI)

When a user uploads a PDF (wire instructions, contract, etc.):

  1. Save to /home/opsadmin/.openclaw/workspace/data/dispo-documents/<dealId>/
  2. Parse with: require('./scripts/lib/pdf-field-extractor').extractFields(buffer, filename)
  3. Show extracted fields for confirmation
  4. Apply confirmed fields to HubSpot deal

Template Variants

Each email type can have multiple HTML design variants stored in Supabase dispo_template_variants table. The active variant is used for production sends. TCs can compare variants side-by-side in the web UI.

Gmail Accounts

  • teamsteph@betterfiles.com — most emails (tokens at workspace-betterfiles/gmail-tokens.json)
  • angel@reri.co — emails 2, 3, 6 (make offer, assignment docs, sign contract)

Invokes / Invoked by

Invokes: SKILL, SKILL Invoked by: _summary, _summary