[object Object]

← back to Dw Chat Analyzer

Add FileMaker on-screen alert recipe (Insert-from-URL pull + OnTimer Show Custom Dialog + Open chat link)

e92a3273c6126834fd592f0750ad95b65cc3646d · 2026-08-11 08:27:14 -0700 · steve

Files touched

Diff

commit e92a3273c6126834fd592f0750ad95b65cc3646d
Author: steve <steve@designerwallcoverings.com>
Date:   Tue Aug 11 08:27:14 2026 -0700

    Add FileMaker on-screen alert recipe (Insert-from-URL pull + OnTimer Show Custom Dialog + Open chat link)
---
 fm-alert-setup.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/fm-alert-setup.md b/fm-alert-setup.md
new file mode 100644
index 0000000..44752fd
--- /dev/null
+++ b/fm-alert-setup.md
@@ -0,0 +1,58 @@
+# FileMaker on-screen alert for new HOT chats — setup (5 min)
+
+**Design:** FileMaker *pulls* new HOT chats from the analyzer via `Insert from URL`
+(no external write to FileMaker Cloud, so no Claris-ID/Cognito auth to fight).
+The analyzer serves them at `GET /api/new-hot?since=<iso>` (Basic Auth admin/DW2024!).
+
+## Prereq
+FileMaker Pro must reach the analyzer. If FileMaker Pro runs **on macstudio3**, use
+`http://127.0.0.1:9802`. If it runs on **another Mac**, tell me and I'll expose the
+endpoint on the LAN IP (it's localhost-only right now).
+
+## 1. (optional) WebChats table — a log of alerted leads
+In `Clients` → Manage Database → new table **WebChats**, fields:
+`chat_id` (text), `arrived_ts` (text), `contact` (text), `location` (text),
+`landing` (text), `chat_link` (text), `seen` (number). Not required for the popup —
+only if you want a running list of leads inside FileMaker.
+
+## 2. Script: "CheckNewChats" (Manage Scripts → new)
+Uses a global field or `$$LAST_HOT_TS` to remember the last alert time.
+
+```
+# first run: seed the cursor to now so you don't get the backlog
+If [ IsEmpty ( $$LAST_HOT_TS ) ]
+  Set Variable [ $$LAST_HOT_TS ; Value: Get(CurrentTimestampUTCMilliseconds) ]  # or a fixed ISO
+End If
+Set Variable [ $url ; Value:
+   "http://127.0.0.1:9802/api/new-hot?since=" & GetAsURLEncoded ( $$LAST_HOT_TS ) ]
+Insert from URL [ With dialog: Off ; Target: $result ; $url ;
+   cURL options: "--user admin:DW2024! --max-time 15" ; Select: On ; Verify SSL: Off ]
+Set Variable [ $count ; Value: JSONGetElement ( $result ; "count" ) ]
+If [ $count > 0 ]
+  Set Variable [ $$LAST_HOT_TS ; Value: JSONGetElement ( $result ; "latest" ) ]
+  Set Variable [ $c ; Value: JSONGetElement ( $result ; "chats[0]" ) ]
+  Show Custom Dialog [ "🔥 New chat lead (" & $count & ")" ;
+     JSONGetElement($c;"contact") & "  ·  " & JSONGetElement($c;"location") &
+     "¶Landing: " & JSONGetElement($c;"landing") ;
+     Buttons: "Open chat" , "Dismiss" ]
+  If [ Get(LastMessageChoice) = 1 ]
+     Open URL [ With dialog: Off ; JSONGetElement($c;"zendesk_link") ]
+  End If
+  # (optional) create a WebChats record here via New Record/Request + Set Field
+End If
+```
+
+## 3. Fire it every 60s
+On the layout you keep open (e.g. the main Clients layout), Layout Setup →
+Script Triggers → **OnTimerInterval? no** — instead run once from a startup script:
+`Install OnTimer Script [ "CheckNewChats" ; Interval: 60 ]`
+(or add `Install OnTimer` to your existing open/startup script). It then polls every
+60s while that window is open and pops a dialog whenever a new HOT chat arrives, with
+an **Open chat** button that jumps to `designerwallcoverings.zendesk.com/chat/agent`.
+
+## Notes
+- The endpoint returns up to 25 newest HOT chats since `since`; the dialog shows the
+  newest + the count. Loop `chats[0..count-1]` if you want one dialog per lead.
+- "HOT" = the visitor left an email/phone (the only reliable lead signal in this data).
+- The analyzer + watcher run under pm2 (dw-chat-analyzer :9802, dw-chat-watch), so
+  this keeps working across reboots.

← 47a430f Chat analyzer: /api/new-hot endpoint for FileMaker to pull (  ·  back to Dw Chat Analyzer  ·  Chat watcher: native macOS on-screen alert (display notifica 7cc0a13 →