← back to Dw Chat Analyzer
Chat watcher: native macOS on-screen alert (display notification, or NOTIFY=dialog for clickable popup) — zero-setup screen alert alongside CNCP/log/FileMaker-pull
7cc0a137da2e0f9d6fc6cc98b13d2b1ac20061ca · 2026-08-11 08:29:02 -0700 · steve
Files touched
Diff
commit 7cc0a137da2e0f9d6fc6cc98b13d2b1ac20061ca
Author: steve <steve@designerwallcoverings.com>
Date: Tue Aug 11 08:29:02 2026 -0700
Chat watcher: native macOS on-screen alert (display notification, or NOTIFY=dialog for clickable popup) — zero-setup screen alert alongside CNCP/log/FileMaker-pull
---
watch.js | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/watch.js b/watch.js
index dfcc065..cad24dd 100644
--- a/watch.js
+++ b/watch.js
@@ -52,6 +52,16 @@ function post(url, body) {
});
}
+function macNotify(title, subtitle, msg) {
+ // Native macOS on-screen alert — pops over whatever's focused (incl. FileMaker) on macstudio3.
+ // NOTIFY=dialog for a clickable popup, else a notification-center banner (default).
+ const esc = s => String(s || '').replace(/["\\]/g, '\\$&').replace(/[\r\n]+/g, ' ');
+ const scpt = (process.env.NOTIFY === 'dialog')
+ ? `display dialog "${esc(subtitle)}\n${esc(msg)}" with title "${esc(title)}" buttons {"Dismiss","Open chat"} default button "Open chat" giving up after 30`
+ : `display notification "${esc(msg)}" with title "${esc(title)}" subtitle "${esc(subtitle)}" sound name "Glass"`;
+ try { require('child_process').spawn('osascript', ['-e', scpt], { detached: true, stdio: 'ignore' }).unref(); } catch {}
+}
+
async function alert(c) {
const v = c.visitor || {};
const loc = [v.city, v.region, v.country].filter(Boolean).join(', ');
@@ -59,6 +69,7 @@ async function alert(c) {
const landing = ((c.webpath || [])[0]?.to || '').replace(/\?.*$/, '');
const line = `${new Date().toISOString()} HOT ${c.id} | ${contact} | ${loc} | ${landing}`;
fs.appendFileSync(LOG, line + '\n');
+ macNotify('🔥 New chat lead', contact + (loc ? ' · ' + loc : ''), 'Landing: ' + (landing || '?'));
const r = await post(CNCP, {
title: `🔥 New HOT chat lead — ${contact}`,
note: `Zendesk visitor left contact. Loc: ${loc || '?'} · Landing: ${landing || '?'} · Open: ${ZLINK}`,
← e92a327 Add FileMaker on-screen alert recipe (Insert-from-URL pull +
·
back to Dw Chat Analyzer
·
Chat watcher: clickable 'Open chat' dialog (opens Zendesk on 6485514 →