Connect Propertybase to Lovable using its Salesforce-based REST API with OAuth2 authentication. Store your Salesforce connected app credentials in Cloud Secrets, then create an Edge Function that obtains OAuth tokens and calls Propertybase's Salesforce API to manage leads, listings, and transactions. Use this to build custom broker dashboards and client portals on top of your brokerage CRM.
Build Custom Broker Dashboards on Top of Propertybase with Lovable
Propertybase is Salesforce for real estate brokerages — it extends Salesforce with real estate-specific objects for listings, transactions, commissions, and agent performance. Brokers who use Propertybase have their operational data in a powerful but complex system. Lovable can build lightweight, role-specific dashboards and client portals on top of this data without requiring users to navigate Salesforce directly.
Because Propertybase runs on the Salesforce platform, the integration uses Salesforce's standard REST API with OAuth2 authentication. A Salesforce Connected App in your org provides the OAuth credentials, and a Lovable Edge Function handles the OAuth token exchange. With a valid access token, the Edge Function can query any Salesforce object — including Propertybase's custom objects like pb__Listing__c, pb__Transaction__c, and pb__Commission__c — and return the data to your Lovable frontend.
The key use cases are custom dashboards for agents showing their active listings, pipeline value, and recent transactions; client portal features where buyers can see properties their agent is tracking for them; brokerage management dashboards showing team performance; and automated reporting that surfaces the most important Propertybase metrics without requiring Salesforce report expertise.
Integration method
Propertybase connects to Lovable through an Edge Function that authenticates with Salesforce's OAuth2 endpoint using a connected app client ID and secret, then calls Propertybase's Salesforce-based REST API. All credentials are stored in Cloud Secrets and the token exchange happens server-side.
Prerequisites
- A Lovable account with a project open and Lovable Cloud enabled
- An active Propertybase subscription running on Salesforce with Admin or API access
- A Salesforce Connected App created in your Propertybase org with OAuth2 enabled
- Salesforce username, password, security token, client ID, and client secret for API access
- Knowledge of the Propertybase custom object API names used in your org (pb__Listing__c, pb__Transaction__c, etc.)
Step-by-step guide
Create a Salesforce Connected App for API Access
Create a Salesforce Connected App for API Access
In your Propertybase/Salesforce org, navigate to Setup (gear icon → Setup). In the Quick Find box, search for 'App Manager'. Click 'New Connected App'. Fill in the required fields: Connected App Name (e.g., 'Lovable Integration'), API Name (auto-populated), Contact Email, and check 'Enable OAuth Settings'. In the OAuth settings section, add a Callback URL (required but not used for username-password flow — use https://localhost/callback as a placeholder). For OAuth Scopes, add 'Access and manage your data (api)' and 'Perform requests on your behalf at any time (refresh_token, offline_access)'. Save the Connected App. After saving, Salesforce generates a Consumer Key (client ID) and Consumer Secret (client secret). These are the credentials your Edge Function will use to authenticate. Navigate back to the Connected App and click 'Manage' → 'Edit Policies'. Set 'Permitted Users' to 'All users may self-authorize' or 'Admin approved users are pre-authorized' depending on your security requirements. For the Lovable Edge Function, also consider setting 'IP Relaxation' to 'Relax IP restrictions' so the function can authenticate from any IP. Note: Salesforce may require 10-15 minutes for the Connected App to propagate before the OAuth credentials work. Also retrieve your Salesforce security token (Setup → Personal Settings → Reset My Security Token) — you may need to append it to your password in the OAuth request.
Pro tip: The Salesforce username-password OAuth flow appends the security token to the password parameter: password + securityToken. For example, if your password is 'MyPassword' and token is 'ABC123', the OAuth password parameter is 'MyPasswordABC123'. Store password and security token separately in Cloud Secrets and combine them in the Edge Function code.
Expected result: A Connected App exists in Salesforce with OAuth enabled. You have the Consumer Key and Consumer Secret, and your Salesforce username, password, and security token are ready.
Store Salesforce and Propertybase Credentials in Cloud Secrets
Store Salesforce and Propertybase Credentials in Cloud Secrets
In Lovable, click the '+' button next to the Preview panel to open the Cloud tab, then navigate to Secrets. Add these secrets: - SALESFORCE_CLIENT_ID: the Connected App's Consumer Key - SALESFORCE_CLIENT_SECRET: the Connected App's Consumer Secret - SALESFORCE_USERNAME: your Salesforce username (email address format) - SALESFORCE_PASSWORD: your Salesforce password - SALESFORCE_SECURITY_TOKEN: your Salesforce security token (separate from password for flexibility) - SALESFORCE_INSTANCE_URL: your Salesforce org's instance URL (e.g., https://myorg.my.salesforce.com) The SALESFORCE_INSTANCE_URL is important — it determines which Salesforce server handles your API requests. Find it in Salesforce Setup → Company Information or simply by looking at the URL in your browser when logged into Salesforce. For Propertybase orgs using Salesforce sandbox environments during development, use the sandbox login URL (https://test.salesforce.com instead of https://login.salesforce.com) and sandbox-specific credentials. Add separate secrets for sandbox vs production and use them in the appropriate Lovable project.
Pro tip: Create a dedicated Salesforce integration user with read-only access to Propertybase objects for Lovable read-only dashboards. This separation of concerns means a compromised Lovable integration doesn't have permission to modify your Propertybase data.
Expected result: All six Salesforce credentials are stored in Cloud Secrets. The Edge Function can construct the OAuth request and make Propertybase API calls using these values.
Create the Propertybase OAuth2 and Query Edge Function
Create the Propertybase OAuth2 and Query Edge Function
Create the Edge Function that handles Salesforce OAuth2 authentication and Propertybase API calls. The username-password OAuth flow sends a POST to https://login.salesforce.com/services/oauth2/token with grant_type=password, client_id, client_secret, username, and password (with security token appended). A successful OAuth response returns an access_token, instance_url, and token_type. The access token is valid for the duration of the session (configurable in Salesforce, typically several hours). Store it in a module-level cache with its expiry to avoid re-authenticating on every request. With the access token, Salesforce REST API calls use the standard format: GET {instance_url}/services/data/v58.0/query/?q=SELECT+Id,Name+FROM+pb__Listing__c. The SOQL (Salesforce Object Query Language) SELECT statement specifies the fields and objects. Propertybase's custom objects have the pb__ namespace prefix on both the object name (pb__Listing__c) and field names (pb__List_Price__c). Ask Lovable to generate the Edge Function with cached authentication and a flexible SOQL query interface so you can add new queries without deploying new functions.
Create an Edge Function called propertybase-proxy at supabase/functions/propertybase-proxy/index.ts. Implement Salesforce OAuth2 username-password flow: POST to https://login.salesforce.com/services/oauth2/token with client_id from SALESFORCE_CLIENT_ID, client_secret from SALESFORCE_CLIENT_SECRET, username from SALESFORCE_USERNAME, password from SALESFORCE_PASSWORD + SALESFORCE_SECURITY_TOKEN concatenated. Cache the access token at module level with a 2-hour TTL. Accept POST requests with: soqlQuery (string, the full SOQL query), and optional nextRecordsUrl (string, for pagination). Call the Salesforce query API at {SALESFORCE_INSTANCE_URL}/services/data/v58.0/query/?q={encodedQuery} with the Bearer token. Return the records array, totalSize, and nextRecordsUrl. Include CORS headers.
Paste this in Lovable chat
1// Key section of propertybase-proxy authentication:2// supabase/functions/propertybase-proxy/index.ts34let cachedToken: string | null = null;5let tokenExpiry: number = 0;67async function getSalesforceToken(): Promise<string> {8 if (cachedToken && Date.now() < tokenExpiry) return cachedToken;910 const params = new URLSearchParams({11 grant_type: "password",12 client_id: Deno.env.get("SALESFORCE_CLIENT_ID") || "",13 client_secret: Deno.env.get("SALESFORCE_CLIENT_SECRET") || "",14 username: Deno.env.get("SALESFORCE_USERNAME") || "",15 password: (Deno.env.get("SALESFORCE_PASSWORD") || "") + (Deno.env.get("SALESFORCE_SECURITY_TOKEN") || ""),16 });1718 const response = await fetch("https://login.salesforce.com/services/oauth2/token", {19 method: "POST",20 headers: { "Content-Type": "application/x-www-form-urlencoded" },21 body: params,22 });2324 if (!response.ok) {25 const error = await response.json();26 throw new Error(`Salesforce auth failed: ${error.error_description}`);27 }2829 const data = await response.json();30 cachedToken = data.access_token;31 tokenExpiry = Date.now() + 7200000; // 2 hours32 return cachedToken;33}Pro tip: Propertybase custom object API names typically follow the pattern pb__ObjectName__c for objects and pb__FieldName__c for custom fields. To discover the exact API names for your org's Propertybase objects, go to Salesforce Setup → Object Manager → filter by 'pb__' to see all Propertybase objects and their fields.
Expected result: The propertybase-proxy Edge Function authenticates with Salesforce and returns Propertybase records for a test SOQL query. Cloud → Logs shows the successful OAuth exchange and query execution.
Build the Agent Pipeline Dashboard
Build the Agent Pipeline Dashboard
With authentication working, open Lovable chat and describe the broker dashboard components. Provide the SOQL queries you want to run and the Propertybase object field names — Lovable generates React components that call the Edge Function with the appropriate queries. SOQL queries for a typical Propertybase dashboard: active listings count uses SELECT COUNT() FROM pb__Listing__c WHERE pb__Status__c = 'Active', pending transactions uses SELECT Id, pb__Property_Address__c, pb__Contract_Price__c FROM pb__Transaction__c WHERE pb__Transaction_Status__c = 'Pending', and recent closed volume uses SELECT SUM(pb__Contract_Price__c) totalVolume FROM pb__Transaction__c WHERE pb__Closed_Date__c = THIS_MONTH AND pb__Transaction_Status__c = 'Closed'. Salesforce's SOQL date literals (THIS_MONTH, LAST_MONTH, THIS_YEAR, LAST_N_DAYS:30) are very useful for dashboard metrics — include them in your prompts so Lovable uses them in the generated queries rather than calculating dates manually. Be careful with SOQL injection: never build SOQL queries by concatenating user input. All user-provided values should be escaped or, better, use Salesforce's query by Id pattern rather than filtering by user-provided strings. For dashboards where the user selects from a dropdown of predefined options, construct SOQL server-side in the Edge Function based on the selected option key.
Using the propertybase-proxy Edge Function, build a broker dashboard page. Run these SOQL queries: (1) 'SELECT COUNT() FROM pb__Listing__c WHERE pb__Status__c = \'Active\'' for active listings count, (2) 'SELECT Id, pb__Property_Address__c, pb__List_Price__c, pb__Status__c, pb__Days_On_Market__c FROM pb__Listing__c WHERE pb__Status__c = \'Active\' ORDER BY pb__Days_On_Market__c DESC LIMIT 5' for top stale listings, (3) 'SELECT COUNT() FROM pb__Transaction__c WHERE pb__Transaction_Status__c = \'Pending\'' for pending transactions, (4) 'SELECT pb__Closed_Date__c, pb__Property_Address__c, pb__Contract_Price__c FROM pb__Transaction__c WHERE pb__Transaction_Status__c = \'Closed\' AND pb__Closed_Date__c = THIS_MONTH ORDER BY pb__Closed_Date__c DESC LIMIT 10' for recent closings. Display as a metrics dashboard with cards at the top and tables for the listings and closings lists.
Paste this in Lovable chat
Pro tip: SOQL queries in JSON strings require escaped single quotes (\') around string values. When writing Lovable prompts that include SOQL, use escaped single quotes for string literals in the WHERE clause to avoid JSON parsing errors.
Expected result: A broker dashboard displays live Propertybase data — active listing count, pending transactions, recent closings from this month. All data comes from your actual Salesforce/Propertybase org.
Add Lead and Contact Management Features
Add Lead and Contact Management Features
Beyond listings and transactions, Propertybase's core CRM value is lead and contact management. Adding lead intake forms that create Salesforce Lead records, contact lookup, and lead status update capabilities transforms a read-only dashboard into a fully functional CRM interface. Creating a Salesforce record uses a POST request to the CRUD endpoints rather than the query endpoint. The Salesforce REST API CRUD endpoints follow the pattern: POST {instance_url}/services/data/v58.0/sobjects/{ObjectName}/ with the field values as a JSON body. For Propertybase leads, POST to /sobjects/Lead/ with required standard Lead fields (LastName, Company) plus any Propertybase custom fields. Update operations use PATCH to /sobjects/{ObjectName}/{recordId} with only the changed fields. Lovable can generate update forms that pre-fill with current values fetched via SOQL and submit only the modified fields in the PATCH request. For complex broker workflows involving Salesforce Process Builder automations or custom lead routing logic already configured in Propertybase, RapidDev's team can help ensure Lovable's API calls trigger the correct automated workflows.
Add a lead intake form to my Propertybase integration. The form should create a new Salesforce Lead record using POST to {SALESFORCE_INSTANCE_URL}/services/data/v58.0/sobjects/Lead/ with fields: FirstName, LastName (required), Email (required), Phone, LeadSource (select: Website/Referral/Cold Call/Open House), pb__Budget__c (currency), pb__Property_Type_Interest__c (select: Single Family/Condo/Multi-Family), Description (text area for notes). Add the create operation to the propertybase-proxy Edge Function. Build the lead intake form with validation and a success toast showing the new lead's name after creation.
Paste this in Lovable chat
Expected result: Submitting the lead intake form creates a new Lead record in Salesforce/Propertybase. The lead appears immediately in Propertybase's lead list with all entered fields populated.
Common use cases
Build an agent performance dashboard from Propertybase data
Brokerage managers need a simple view of each agent's pipeline — active listings, pending transactions, closed volume this month versus quota. A Lovable dashboard queries Propertybase's Salesforce objects and displays the metrics in a clean format that agents actually want to use.
My Propertybase org is connected to Salesforce. I've created a Connected App and stored SALESFORCE_CLIENT_ID, SALESFORCE_CLIENT_SECRET, SALESFORCE_USERNAME, SALESFORCE_PASSWORD, and SALESFORCE_INSTANCE_URL in Cloud Secrets. Create an Edge Function called propertybase-proxy that authenticates with Salesforce OAuth2 username-password flow and queries Propertybase objects. Then build an agent dashboard showing: active listings count (pb__Listing__c where Status = 'Active'), pending transactions (pb__Transaction__c where Stage = 'Pending'), closed volume this month (sum of pb__Contract_Price__c where CloseDate this month), and a list of the 5 most recent listings with address, price, and status.
Copy this prompt to try it in Lovable
Create a client portal showing properties saved by their agent
Buyer's agents manually track client property preferences and shortlists in Propertybase. A Lovable client portal lets buyers log in and see the properties their agent has saved for them, reducing back-and-forth emails and giving clients 24/7 access to their search status.
I want to build a client portal showing buyers the properties their agent has saved for them. In Propertybase/Salesforce, agents store client searches as Opportunity records with related property listings. Using SALESFORCE_CLIENT_ID, SALESFORCE_CLIENT_SECRET, SALESFORCE_USERNAME, SALESFORCE_PASSWORD, SALESFORCE_INSTANCE_URL from Cloud Secrets, create an Edge Function that queries Opportunity records filtered by a client email address, returns related pb__Listing__c records with address, price, beds, baths, photos, and agent notes. Build a client portal page with login, a saved properties grid with photo thumbnails, and a 'Request showing' button that emails the agent.
Copy this prompt to try it in Lovable
Build a commission calculator and tracker integrated with Propertybase transactions
Propertybase tracks transactions and commissions in Salesforce objects. Agents want a clean view of their commission pipeline — transactions in progress, expected commission amounts, and year-to-date earnings — without logging into Salesforce's complex UI.
Create an agent commission tracker using Propertybase data. The relevant Salesforce objects are: pb__Transaction__c (fields: pb__Property_Address__c, pb__Contract_Price__c, pb__Close_Date__c, pb__Transaction_Status__c) and pb__Commission__c (fields: pb__Transaction__c relation, pb__Agent__c, pb__Amount__c, pb__Status__c). Using the propertybase-proxy Edge Function, build a commission page showing: pending commissions with transaction details and expected amounts, year-to-date commission total, a monthly chart of commission earnings, and upcoming closings with estimated commission.
Copy this prompt to try it in Lovable
Troubleshooting
Salesforce OAuth returns 'INVALID_CLIENT_CREDENTIALS: client identifier invalid'
Cause: The Connected App's Consumer Key (Client ID) or Consumer Secret is incorrect, or the Connected App has not fully propagated (takes up to 15 minutes after creation).
Solution: Verify the Consumer Key and Consumer Secret by navigating to Setup → App Manager → find your Connected App → View → Manage Consumer Details (may require identity verification). Copy the values character by character rather than relying on auto-fill. If you just created the Connected App, wait 15 minutes before testing — Salesforce Connected Apps take time to activate.
Salesforce OAuth returns 'INVALID_LOGIN: Invalid username, password, security token; or user locked out'
Cause: The username, password, or security token is incorrect. The security token may have been reset since you last retrieved it, or the password+token combination format is wrong.
Solution: Reset your Salesforce security token: go to Salesforce → profile avatar → Settings → Personal Information → Reset My Security Token. Salesforce emails the new token to your registered email. Update the SALESFORCE_SECURITY_TOKEN secret in Lovable with the new token. Ensure your Edge Function concatenates password and token without a space: Deno.env.get('SALESFORCE_PASSWORD') + Deno.env.get('SALESFORCE_SECURITY_TOKEN').
SOQL query returns 'INVALID_FIELD: pb__Status__c does not exist' error
Cause: The Propertybase field API name is incorrect. Custom field names vary between Propertybase versions and org customizations.
Solution: Find exact field API names in Salesforce Setup → Object Manager → search for the object (e.g., pb__Listing__c) → Fields & Relationships. The API Name column shows the exact name to use in SOQL. Custom fields end in __c. Also note that some Propertybase fields may have been renamed or added in your org by your Salesforce admin — what appears in the UI may differ from the API name.
Propertybase dashboard loads slowly (3-8 seconds) on first access
Cause: The Salesforce OAuth token has expired and the Edge Function is re-authenticating on the first request after the cache expires, adding 1-2 seconds. Multiple parallel SOQL queries also add latency.
Solution: Implement parallel query execution in the Edge Function using Promise.all() to run multiple SOQL queries simultaneously rather than sequentially. Pre-warm the token cache by making the authentication request slightly before the cached token expires (at 80% of its validity period). For dashboard data that changes hourly, consider caching SOQL results in Supabase with a short TTL rather than hitting Salesforce on every page load.
1// Execute multiple SOQL queries in parallel2const [activeListings, pendingTransactions, recentClosings] = await Promise.all([3 queryPropertybase(token, instanceUrl, "SELECT COUNT() FROM pb__Listing__c WHERE pb__Status__c = 'Active'"),4 queryPropertybase(token, instanceUrl, "SELECT COUNT() FROM pb__Transaction__c WHERE pb__Transaction_Status__c = 'Pending'"),5 queryPropertybase(token, instanceUrl, "SELECT Id, pb__Property_Address__c FROM pb__Transaction__c WHERE pb__Transaction_Status__c = 'Closed' AND pb__Closed_Date__c = THIS_MONTH LIMIT 10"),6]);Best practices
- Cache the Salesforce OAuth access token at module level with its expiry time to avoid re-authenticating on every Edge Function request
- Use a dedicated Salesforce integration user with read-only permissions for read-only Lovable dashboards to limit the impact of compromised credentials
- Never concatenate user input directly into SOQL queries — always sanitize or use parameterized approaches through Salesforce's REST query API
- Use SOQL date literals (THIS_MONTH, LAST_N_DAYS:30, THIS_YEAR) rather than calculating date strings manually for time-based filters
- Look up exact Propertybase field API names in Salesforce Setup → Object Manager rather than guessing — field names vary between Propertybase versions and org customizations
- Execute multiple dashboard queries in parallel using Promise.all() rather than sequentially to reduce page load time
- Store the Salesforce password and security token as separate secrets and concatenate them in the Edge Function code — this makes it easier to update each independently when they change
- Create separate Salesforce Connected Apps and Cloud Secret sets for development (sandbox) and production Propertybase orgs
Alternatives
Realtor.com provides public residential listing data via RapidAPI — choose it for consumer-facing listing search rather than brokerage CRM operations.
CoStar provides commercial real estate market data and analytics — choose it for investment analysis tools rather than brokerage CRM workflow management.
Connect directly to the Salesforce platform when you need to access Salesforce standard objects alongside Propertybase custom objects, or when your org uses Salesforce without the Propertybase package.
Frequently asked questions
Does this integration work with Propertybase Go (the newer version) or only Propertybase CRM?
Propertybase CRM runs on Salesforce and uses the Salesforce REST API as described in this guide. Propertybase Go is a separate, non-Salesforce SaaS product with its own API. If you are using Propertybase Go, the authentication pattern and API endpoints are different — Go uses its own REST API with a separate authentication mechanism. Check which version of Propertybase your brokerage uses before following this guide.
Can I use this integration to trigger Salesforce workflow rules and process builder automations?
Yes. When you create or update records via the Salesforce REST API, Salesforce triggers all active workflow rules, process builder flows, and validation rules for that object just as if the record was modified in the UI. This means your Lovable integration automatically benefits from existing Propertybase automations — lead assignment rules, status notification emails, and task creation workflows all fire when records are created or updated via the Edge Function.
How do I handle Salesforce's governor limits when building data-intensive dashboards?
Salesforce enforces API call limits per 24-hour period based on your license count (typically 15,000 to millions of calls per day for enterprise orgs). To stay well within limits, cache dashboard data in Supabase with a 5-15 minute TTL rather than fetching live on every page load. Use SOQL aggregate queries (SELECT COUNT(), SUM(Amount)) rather than fetching all records and summing in JavaScript. Monitor your API usage in Salesforce Setup → System Overview → API Usage.
What Propertybase data can I display publicly versus only to authenticated users?
All Propertybase data is brokerage-confidential and should be displayed only to authenticated users. Leads, transactions, commission amounts, and internal notes are sensitive business data. Implement Supabase Auth in your Lovable app to require login before accessing any Propertybase data. Role-based access (agents see only their own listings, managers see all) can be enforced in the Edge Function by filtering SOQL results based on the logged-in user's identity.
Can I use Connected App certificate-based authentication instead of username-password OAuth for better security?
Yes, Salesforce supports JWT-bearer OAuth flow using a self-signed certificate, which is more secure than username-password flow because it does not require storing the user's password. This requires uploading a certificate to the Connected App and generating JWTs in the Edge Function using the private key. The setup is more complex but recommended for production applications. For initial development, username-password flow is acceptable; consider migrating to certificate-based authentication before go-live in production environments.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation