← back to Dw Chat Analyzer
Chat watcher: clickable 'Open chat' dialog (opens Zendesk on click) as default on-screen alert; NOTIFY=banner for the quieter banner
6485514810a9b57b62f6878e99dea523b855e211 · 2026-08-11 08:30:58 -0700 · steve
Files touched
Diff
commit 6485514810a9b57b62f6878e99dea523b855e211
Author: steve <steve@designerwallcoverings.com>
Date: Tue Aug 11 08:30:58 2026 -0700
Chat watcher: clickable 'Open chat' dialog (opens Zendesk on click) as default on-screen alert; NOTIFY=banner for the quieter banner
---
watch.js | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/watch.js b/watch.js
index cad24dd..16a255a 100644
--- a/watch.js
+++ b/watch.js
@@ -52,13 +52,15 @@ function post(url, body) {
});
}
-function macNotify(title, subtitle, msg) {
+function macNotify(title, subtitle, msg, url) {
// 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).
+ // NOTIFY=dialog (default here) = clickable popup whose "Open chat" button opens the chat;
+ // NOTIFY=banner = a notification-center banner instead.
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"`;
+ const scpt = (process.env.NOTIFY === 'banner')
+ ? `display notification "${esc(msg)}" with title "${esc(title)}" subtitle "${esc(subtitle)}" sound name "Glass"`
+ : `set r to display dialog "${esc(subtitle)}\n${esc(msg)}" with title "${esc(title)}" buttons {"Dismiss","Open chat"} default button "Open chat" with icon note giving up after 120
+ if button returned of r is "Open chat" then open location "${esc(url)}"`;
try { require('child_process').spawn('osascript', ['-e', scpt], { detached: true, stdio: 'ignore' }).unref(); } catch {}
}
@@ -69,7 +71,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 || '?'));
+ macNotify('🔥 New chat lead', contact + (loc ? ' · ' + loc : ''), 'Landing: ' + (landing || '?'), ZLINK);
const r = await post(CNCP, {
title: `🔥 New HOT chat lead — ${contact}`,
note: `Zendesk visitor left contact. Loc: ${loc || '?'} · Landing: ${landing || '?'} · Open: ${ZLINK}`,
← 7cc0a13 Chat watcher: native macOS on-screen alert (display notifica
·
back to Dw Chat Analyzer
·
Chat watcher: alert activates FileMaker then pops the dialog 671da21 →