← back to Rc Fm Callnotes
README.md
27 lines
# rc-fm-callnotes
RingCentral → FileMaker Pro call-notes sync + lazy caller-ID contact sync.
Every 5 minutes (launchd `com.steve.rc-fm-callnotes`), pulls completed external
calls from the RingCentral company call log and, per call:
1. **Match client** in the FileMaker `Clients` file by phone number
(6 format variants ORed in one Data API find).
2. **Matched** → a dated call note is prepended to the client's `Notes` field
(append-only, newest on top). **No match** → a new client record is created
with the caller's name/number and all call info in `Notes`.
3. **Invoice references** in note text (`invoice 102387`, `inv# …`) → the note is
stamped (with date + time) into that invoice's `Internal notes`.
4. **Caller-ID**: the caller is upserted into the RingCentral address book
(name + company + DW account number) so their name shows in RC on future calls.
Lazy sync — every client who calls gets added; 44k clients won't fit RC's cap.
## Ops
- Kill switch: `touch STOP` in the project root (poller exits without running).
- State: `data/state.json` (checkpoint + seen call IDs).
- Secrets: `data/rc-config.json` (RC JWT, gitignored — copy from
Kamatera `/root/DW-Agents/ringcentral-agent/config.json`); FileMaker creds are
read from `~/Projects/filemaker-mcp/.env`.
- Test: `node test-run.mjs` — full pipeline against TEST-marked records.
- RingSense hook: `rec._noteText` carries AI note text when RingSense is licensed.