POST /api/onboarding-v2
End-to-end automation entry point for new companies. Invoked when the onboarding form at my.reformer.la/onboarding completes. The endpoint pulls everything from Supabase, ensures the account/member records exist, and then executes the full automation cascade via services/automation-orchestrator.js.
Request
Content-Type: application/json
{
"email": "client@example.com",
"companyName": "Client Co",
"companyUrl": "https://client.co",
"phone": "+1-555-111-2222",
"location": "Los Angeles, CA",
"timezone": "America/Los_Angeles",
"plan": "growth",
"metadata": {
"referrer": "landing-page"
}
}
Accepted aliases:
company_name,company,businessNamecompany_url,website,domainphone_numbercity_state,citytime_zone
Required fields: email, companyName
Response
Success (200)
{
"success": true,
"accountId": "uuid",
"portalSlug": "client-co",
"integrations": {
"clickup": "success",
"dropbox": "success",
"resend": "success",
"slack": "success",
"close": "success"
}
}
Failure (4xx/5xx)
400 Missing required fields
500 Internal error (integration failures reported individually)
Workflow
- Member lookup / create
- Query Supabase-backed
memberstable. - If missing, create
accounts+membersentries withstatus='provisioning'.
- Query Supabase-backed
- Company metadata update
- Update
accountswith latest contact info.
- Update
- Ensure Supabase integration record
- Creates integration row with generated webhook secret.
- Portal slug assignment
- Calls
ensurePortalSlugto maintain unique dashboard URLs.
- Calls
- Automation orchestrator
- Creates ClickUp project structure (
services/clickup-service.js). - Creates Dropbox folder tree at
/Reformer General/Reformer Clients Folder/{normalized-slug}with all 10 subdirectories. - Stores Dropbox link in
members.dropbox_linkfor client portal access. - Sends Resend onboarding emails (primary email service).
- Posts Slack notifications.
- Updates Close CRM lead record.
- (Future) triggers analytics setup and additional integrations.
- Creates ClickUp project structure (
Enhanced Onboarding API
The /api/onboarding/enhanced endpoint includes additional steps:
- Account Creation - Creates account and member records
- Dropbox Folder Creation (Step 1.5) - Creates standardized folder structure
- PageSpeed Analysis - Analyzes client website performance
- Content Scraping - Scrapes website content for analysis
- CSV Upload - Uploads scraped content to Dropbox
- Close CRM Update - Updates CRM with client information
- Slack Notification - Notifies team of new client
Dropbox Folder Structure:
- Path:
/Reformer General/Reformer Clients Folder/{normalized-slug} - Automatically creates 10 standardized subdirectories
- Generates shared link and stores in
members.dropbox_link - Link is available in client portal after onboarding completes
If any integration fails, the endpoint returns success: false with the error details, and the orchestrator logs the failure for follow-up.
Required Environment Variables
DATABASE_URL– Supabase Postgres connection.CLICKUP_*– All ClickUp space/list IDs and API key.DROPBOX_ACCESS_TOKENSLACK_WEBHOOK_URLRESEND_API_KEY(primary email service).CLOSE_API_KEYCURSOR_API_KEY(if automation triggers Cloud Agents).
Confirm all variables are set in Render before enabling production runs. See reformer-platform/ENV-TEMPLATE.md.
Testing
- Trigger manually with curl:
curl -X POST https://reformer-platform.onrender.com/api/onboarding-v2 \
-H "Content-Type: application/json" \
-d '{"email":"test+onboarding@reformer.la","companyName":"Test Co"}'
- Verify ClickUp folder under Client Projects space.
- Confirm Dropbox folder (
/Clients/test-co). - Check Slack #engineering (or dedicated channel) for notifications.
- Inspect Supabase
accounts,members,integrationstables.
Automated regression tests are planned for the orchestrator; for now, rerun this endpoint with staging credentials when significant integration code changes.***