Dropbox Integration
Dropbox automates client directory provisioning. The logic lives in reformer-platform/services/dropbox-service.js and uses a token refresh helper to keep access valid.
Environment Variables
Ensure the following are set in Render/GitHub secrets:
DROPBOX_ACCESS_TOKEN=sl.***
DROPBOX_REFRESH_TOKEN=*** (if using token refresh script)
DROPBOX_APP_KEY=***
DROPBOX_APP_SECRET=***
See scripts/setup-dropbox-business.sh and CHECK-DROPBOX-ENV.md (if present) for the initial setup.
Token Management
tokenManager.getValidToken()(fromdropbox-token-refresh.js) is called for every request.- Refresh tokens prevent expiration for long-running automations; monitor logs for refresh failures.
Folder Creation Workflow
createMemberDirectory({ accountId, memberId, email, memberType, clientName }):
- Normalize company name to slug format (
clientName→client-name-slug). - Check if
/Reformer General/Reformer Clients Folder/{normalized-slug}exists. - If exists, returns path + shared link (creates one if missing).
- If new:
- Creates base folder at
/Reformer General/Reformer Clients Folder/{normalized-slug}. - Creates standardized subdirectories:
01 - Brand Assets
02 - Content
03 - Design Files
04 - Documents
05 - Images
06 - Logos
07 - Marketing Materials
08 - Social Media
09 - Videos
10 - Web Assets - Generates shared link (public viewer).
- Stores metadata in
memberstable (dropbox_path,dropbox_link). - Logs event in
activity_log(dropbox.directory_created).
- Creates base folder at
Folder Structure
/Reformer General/
└── Reformer Clients Folder/
├── client-1-slug/
├── client-2-slug/
└── {normalized-slug}/
├── 01 - Brand Assets/
├── 02 - Content/
├── 03 - Design Files/
├── 04 - Documents/
├── 05 - Images/
├── 06 - Logos/
├── 07 - Marketing Materials/
├── 08 - Social Media/
├── 09 - Videos/
└── 10 - Web Assets/
Note: Uses pre-created template directory structure. Client folders are created inside /Reformer General/Reformer Clients Folder/ using normalized slug naming.
Additional Helpers
getMemberDropboxLink(accountId, memberId)— fetch stored path/link.createSubfolder(memberId, subfolderName)— add additional folders.uploadFile(memberId, filePath, fileContent)— upload binary content (uses/uploadendpoint).getExistingSharedLink(path)— reuse existing share links when possible.
Error Handling & Monitoring
healthMonitor.recordError('dropbox', error)tracks failures.- Console logs provide context (
Error creating Dropbox directory structure, etc.). - If
DROPBOX_ACCESS_TOKENmissing, service short-circuits and returns null.
Operational Notes
- Run Dropbox folder creation as part of onboarding orchestrator (
automation-orchestrator.js). - If manual workarounds are needed, the onboarding ClickUp tasks describe the same steps.
- Keep refresh tokens rotated and verify the Dropbox app has required scopes (
files.content.write,sharing.write, etc.).
Future enhancements: multi-tenant folder templates, automatic cleanup on account cancellation, Slack notifications on success/failure.***