This guide explains how to connect DealSentry to Salesforce so you can sync open Opportunities into proposals.
- In
.env, ensure:SALESFORCE_DEMO_MODE="true"
- Start the app and go to Integrations.
- Click Connect on the Salesforce card.
- You are redirected back with Salesforce marked as “connected” (demo). Sync will not pull real data.
If you don’t see “New Connected App” or get permission errors, see “I can’t create a Connected App” below.
- Log in to Salesforce (or Sandbox for testing).
- Go to Setup (gear icon) → Setup (opens in new tab). In the left Quick Find box, type App Manager and open App Manager.
- Click New Connected App (top right).
- Fill in:
- Connected App Name: e.g.
DealSentry - API Name: auto-filled
- Contact Email: your email
- Connected App Name: e.g.
- Enable OAuth Settings:
- Check Enable OAuth Settings.
- Callback URL (must match your backend exactly):
- Local:
http://localhost:3001/api/oauth/salesforce/callback - Production:
https://your-api-domain.com/api/oauth/salesforce/callback
- Local:
- Selected OAuth Scopes: add:
- Access and manage your data (api)
- Perform requests at any time (refresh_token)
- Allow access to your unique identifiers (openid) (optional)
- Under Additional Settings (if shown):
- Refresh Token Policy: “Refresh token is valid until revoked”.
- Save. Wait a few minutes for the app to activate.
- In the Connected App, open Manage Consumer Details and note:
- Consumer Key → use as
SALESFORCE_CLIENT_ID - Consumer Secret → use as
SALESFORCE_CLIENT_SECRET
- Consumer Key → use as
In your project .env:
# Disable demo mode
SALESFORCE_DEMO_MODE="false"
# From Connected App > Manage Consumer Details
SALESFORCE_CLIENT_ID="your_consumer_key_here"
SALESFORCE_CLIENT_SECRET="your_consumer_secret_here"
# Callback URL must match the value in the Connected App exactly
# Default backend port is 3001 (see server.ts / API_PORT)
SALESFORCE_REDIRECT_URI="http://localhost:3001/api/oauth/salesforce/callback"
# Use "true" for Salesforce Sandbox (test.salesforce.com)
SALESFORCE_SANDBOX="false"For production, set:
SALESFORCE_REDIRECT_URI="https://your-api-domain.com/api/oauth/salesforce/callback"SALESFORCE_SANDBOX="true"only if the Connected App was created in a Sandbox.
- Backend (API) must be running on the port used in
SALESFORCE_REDIRECT_URI(e.g. 3001). - Frontend: e.g.
http://localhost:8080.
npm run server # API on port 3001
npm run dev # Frontend (e.g. 8080)
# Or: npm run dev:full- Open Integrations (e.g.
http://localhost:8080/integrations). - Find Salesforce and click Connect.
- You are redirected to Salesforce to log in and authorize the app.
- After authorizing, you are redirected back to Integrations with Salesforce shown as connected.
- On the Integrations page, with Salesforce connected, click Sync (or the sync action for Salesforce).
- The app fetches open Opportunities (not closed) from Salesforce (up to 100, by last modified).
- New opportunities are created as proposals in DealSentry with:
- Title = Opportunity Name
- Content = Opportunity Description (or a short summary if empty)
- Metadata: Account name, Amount, Stage, Close Date,
opportunityId, etc.
- Opportunities that were already imported are skipped (matched by
opportunityIdin proposal metadata).
If you don’t see New Connected App in App Manager, or you get “page not found” / “insufficient privileges”, do the following.
Your user must have permission to create Connected Apps.
- Setup → Users → Profiles → open your profile (e.g. System Administrator).
- Under Administrative Permissions, ensure:
- Customize Application = checked
- Manage Connected Apps (or Create and Manage Connected Apps) = checked
- Save.
If your profile is locked (e.g. standard “System Administrator” with lock icon), you may not be able to edit it. In that case use a Permission Set (see step 3) or a different profile that has these permissions.
- Click the gear icon → Setup (the main Setup, not a community or site).
- In the left sidebar, use Quick Find and type: App Manager.
- Open App Manager (under Apps).
- On the App Manager page, the button is New Connected App (top right).
If you don’t see it, your profile/permission set doesn’t allow creating Connected Apps (see step 1 and 3).
- Setup → Users → Permission Sets → New (or open an existing one).
- Manage Connected Apps = checked (under App Permissions or similar).
- Object Settings → ensure API access is enabled if required.
- Assign the permission set to your user: Manage Assignments → add your user.
Connected Apps with OAuth often require My Domain to be set up.
- Setup → Company Settings → My Domain (or Quick Find: My Domain).
- If it says “My Domain is not configured”, click Configure and follow the wizard (subdomain + deploy to users). This can take a few minutes.
- After My Domain is deployed, try creating the Connected App again.
If your org is locked down by an admin:
- Sign up for a free Salesforce Developer Edition (or Trial).
- In that org you’ll have System Administrator with Manage Connected Apps.
- Create the Connected App there and use its Consumer Key/Secret in DealSentry.
- For local testing, callback URL:
http://localhost:3001/api/oauth/salesforce/callback. - Set
SALESFORCE_SANDBOX="false"for Developer Edition (it uses login.salesforce.com).
If you’re in a company org and can’t get the permissions above:
- Ask an admin to create a Connected App for "DealSentry" with:
- Callback URL:
http://localhost:3001/api/oauth/salesforce/callback(or your production callback). - OAuth scopes: api, refresh_token.
- Callback URL:
- They can then give you the Consumer Key and Consumer Secret (from Manage Consumer Details) to put in your
.envasSALESFORCE_CLIENT_IDandSALESFORCE_CLIENT_SECRET. You don’t need to create the app yourself.
| Issue | What to check |
|---|---|
| Redirect/callback error | SALESFORCE_REDIRECT_URI must match exactly the Callback URL in the Connected App (including port and path). |
| “Invalid client” / 401 | Correct SALESFORCE_CLIENT_ID and SALESFORCE_CLIENT_SECRET; Connected App activated. |
| Sandbox vs Production | Use SALESFORCE_SANDBOX="true" only for Sandbox (test.salesforce.com). |
| Sync fails / “Please reconnect” | Token may be expired or revoked. Disconnect and connect again from Integrations. |
| No opportunities synced | Only open (not closed) opportunities are queried. Ensure you have open Opportunities in Salesforce. |
- OAuth: Authorization code flow; tokens (and optional refresh) stored in DB (Integration credentials).
- Sync: GET open Opportunities via Salesforce REST API (e.g.
v60.0), then insert new ones as Proposals withmetadata.opportunityIdto avoid duplicates. - Ports: API default
3001; frontend default8080. AdjustSALESFORCE_REDIRECT_URIandFRONTEND_URLif you use different ports or domains.