Skip to main content
RapidDev - Software Development Agency
bubble-tutorial

How to integrate Salesforce with Bubble

Connect your Bubble app to Salesforce CRM using the API Connector with OAuth2 authentication. This tutorial covers setting up a Salesforce Connected App, configuring OAuth2 in Bubble, syncing leads and contacts, querying Salesforce data with SOQL, and handling Salesforce's pagination for large datasets — all through Bubble's visual editor.

What you'll learn

  • How to create a Salesforce Connected App for API access
  • How to configure OAuth2 authentication in Bubble's API Connector
  • How to create, read, and update Salesforce records from Bubble workflows
  • How to handle Salesforce's API pagination for large data sets
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner7 min read25-30 minAll Bubble plans (Salesforce API requires Salesforce Enterprise+ or Developer edition)March 2026RapidDev Engineering Team
TL;DR

Connect your Bubble app to Salesforce CRM using the API Connector with OAuth2 authentication. This tutorial covers setting up a Salesforce Connected App, configuring OAuth2 in Bubble, syncing leads and contacts, querying Salesforce data with SOQL, and handling Salesforce's pagination for large datasets — all through Bubble's visual editor.

Overview: Integrating Salesforce with Bubble

Connecting Bubble to Salesforce lets you sync leads, contacts, and opportunities between your Bubble app and your CRM. This tutorial walks through the complete integration: creating a Salesforce Connected App, setting up OAuth2 authentication in the API Connector, building workflows to create and query Salesforce records, and handling pagination for large datasets. This is ideal for founders who use Bubble for their customer-facing app and Salesforce for sales operations.

Prerequisites

  • A Bubble account with an app
  • A Salesforce account with API access (Enterprise, Unlimited, or Developer edition)
  • Admin access to Salesforce Setup for creating a Connected App
  • Basic understanding of Bubble's API Connector plugin

Step-by-step guide

1

Create a Salesforce Connected App

Log in to Salesforce and go to Setup (gear icon → Setup). In the Quick Find search box, type 'App Manager' and click on it. Click 'New Connected App.' Fill in the required fields: Connected App Name (e.g., 'Bubble Integration'), API Name (auto-fills), and Contact Email. Under API → Enable OAuth Settings, check the box. Set the Callback URL to https://yourapp.bubbleapps.io/api/1.1/oauth_redirect. Under Selected OAuth Scopes, add 'Full access (full)' and 'Perform requests at any time (refresh_token, offline_access).' Click Save. Wait 2-10 minutes for the app to be ready, then copy the Consumer Key (Client ID) and Consumer Secret.

Pro tip: The Callback URL must match exactly what Bubble expects. Use your app's actual domain, not a placeholder.

Expected result: A Salesforce Connected App with a Client ID and Client Secret ready for OAuth2 configuration in Bubble.

2

Configure OAuth2 in Bubble's API Connector

In Bubble, go to Plugins tab → API Connector → Add another API. Name it 'Salesforce.' Set Authentication to 'OAuth2 User-Agent Flow.' Fill in the fields: App ID = your Salesforce Consumer Key, App Secret = your Salesforce Consumer Secret, Scope = full refresh_token, Authorization URL = https://login.salesforce.com/services/oauth2/authorize, Token URL = https://login.salesforce.com/services/oauth2/token. Click 'Authenticate' — a Salesforce login window opens. Log in with your Salesforce credentials and authorize the app. After redirect, Bubble stores the access and refresh tokens.

Expected result: Bubble is authenticated with Salesforce via OAuth2 and can make API calls on behalf of your Salesforce user.

3

Create a Salesforce Lead from a Bubble form

Add an API call in the Salesforce group named 'Create Lead.' Set method to POST, URL to https://yourinstance.salesforce.com/services/data/v59.0/sobjects/Lead. Add Header: Content-Type = application/json. The body should include Lead fields as parameters: FirstName, LastName, Email, Company, Phone. Set 'Use as' to Action. Initialize the call with test data. Now on your Bubble form page, create a workflow: When Submit is clicked → Call 'Create Lead' action with the form input values mapped to the parameters. The API returns the new Lead's Salesforce ID.

API Connector payload
1POST /services/data/v59.0/sobjects/Lead
2
3Body:
4{
5 "FirstName": "<dynamic_first_name>",
6 "LastName": "<dynamic_last_name>",
7 "Email": "<dynamic_email>",
8 "Company": "<dynamic_company>",
9 "Phone": "<dynamic_phone>",
10 "LeadSource": "Bubble App"
11}

Expected result: Submitting the Bubble form creates a new Lead record in Salesforce with all the form data.

4

Query Salesforce data using SOQL

Add an API call named 'Query Contacts.' Set method to GET, URL to https://yourinstance.salesforce.com/services/data/v59.0/query?q=[soql_query]. Add a parameter called soql_query. Set 'Use as' to Data so you can bind results to Repeating Groups. Initialize with a sample query like SELECT Id, FirstName, LastName, Email FROM Contact LIMIT 10. The response includes a records array. In your Bubble page, add a Repeating Group with Type: Query Contacts result, Data source: Get data from external API → Salesforce - Query Contacts, with the soql_query parameter set dynamically (e.g., from a search input).

Pro tip: SOQL (Salesforce Object Query Language) is similar to SQL. Use WHERE clauses for filtering: SELECT Id, Name FROM Lead WHERE LeadSource = 'Bubble App'.

Expected result: Salesforce data displays in a Bubble Repeating Group, queryable via SOQL through the API Connector.

5

Handle Salesforce API pagination

Salesforce returns a maximum of 2,000 records per query. For larger datasets, the response includes a nextRecordsUrl field. Create a second API call named 'Get Next Records' with GET method and URL set to https://yourinstance.salesforce.com[nextRecordsUrl]. After calling the initial query, check if the response's done field is false. If so, call 'Get Next Records' with the nextRecordsUrl value to fetch the next batch. In your workflow, you can use a recursive backend workflow: call the query, process the records, and if done = false, schedule the same backend workflow with the nextRecordsUrl.

Expected result: Your app can retrieve all Salesforce records regardless of dataset size by following pagination links.

6

Update Salesforce records from Bubble

Add an API call named 'Update Contact.' Set method to PATCH, URL to https://yourinstance.salesforce.com/services/data/v59.0/sobjects/Contact/[salesforce_id]. Add a parameter salesforce_id for the record's Salesforce ID. The body contains only the fields you want to update. Set 'Use as' to Action. In your Bubble workflow, call this action with the Salesforce ID stored in your Bubble database and the updated field values. A successful update returns status 204 (no content). For bidirectional sync where Salesforce changes flow back to Bubble, RapidDev can help set up Salesforce outbound messages or platform events connected to Bubble backend workflows.

API Connector payload
1PATCH /services/data/v59.0/sobjects/Contact/<salesforce_id>
2
3Body:
4{
5 "Phone": "<dynamic_new_phone>",
6 "Email": "<dynamic_new_email>"
7}

Expected result: Bubble workflows can update existing Salesforce records by passing the record ID and new field values.

Complete working example

API Connector payload
1{
2 "Salesforce_API_Calls": {
3 "Authentication": "OAuth2 User-Agent Flow",
4 "App_ID": "<Salesforce Consumer Key>",
5 "App_Secret": "<Salesforce Consumer Secret>",
6 "Auth_URL": "https://login.salesforce.com/services/oauth2/authorize",
7 "Token_URL": "https://login.salesforce.com/services/oauth2/token",
8 "Scope": "full refresh_token",
9 "API_Calls": {
10 "Create_Lead": {
11 "method": "POST",
12 "url": "/services/data/v59.0/sobjects/Lead",
13 "body": {
14 "FirstName": "<param>",
15 "LastName": "<param>",
16 "Email": "<param>",
17 "Company": "<param>",
18 "Phone": "<param>",
19 "LeadSource": "Bubble App"
20 },
21 "use_as": "Action"
22 },
23 "Query_Records": {
24 "method": "GET",
25 "url": "/services/data/v59.0/query?q=<soql_query>",
26 "use_as": "Data"
27 },
28 "Get_Next_Records": {
29 "method": "GET",
30 "url": "<nextRecordsUrl>",
31 "use_as": "Action"
32 },
33 "Update_Record": {
34 "method": "PATCH",
35 "url": "/services/data/v59.0/sobjects/<object>/<record_id>",
36 "body": { "field": "<new_value>" },
37 "use_as": "Action"
38 }
39 }
40 }
41}

Common mistakes when integrating Salesforce with Bubble

Why it's a problem: Using the wrong Salesforce instance URL

How to avoid: After OAuth2 authentication, the token response includes an instance_url field. Use this URL for all subsequent API calls.

Why it's a problem: Not handling token expiration

How to avoid: Bubble's OAuth2 flow handles refresh tokens automatically, but verify that 'refresh_token' is included in your OAuth scope.

Why it's a problem: Trying to create records with missing required fields

How to avoid: Check the Salesforce object definition for required fields and ensure your Bubble form collects all of them before calling the API.

Best practices

  • Store the Salesforce record ID in your Bubble database to maintain the link between Bubble and Salesforce records
  • Use SOQL WHERE clauses to filter data server-side instead of fetching all records and filtering in Bubble
  • Handle pagination for queries that may return more than 2,000 records
  • Test all API calls in a Salesforce sandbox environment before connecting to production
  • Log API responses to a database for debugging failed syncs
  • Include the LeadSource field when creating records so you can track which leads came from your Bubble app
  • Set up error handling workflows that notify administrators when Salesforce API calls fail

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I want to connect my Bubble.io app to Salesforce CRM. I need to create leads from a form, query contacts, and update records. Can you help me set up the OAuth2 authentication and API calls using Bubble's API Connector?

Bubble Prompt

Help me set up a form that sends data to Salesforce as a new Lead. I need fields for first name, last name, email, company, and phone. When the form is submitted, create the Lead in Salesforce via the API Connector.

Frequently asked questions

Does Salesforce's free Developer Edition support API access?

Yes. The Salesforce Developer Edition includes full API access and is free. It is ideal for testing your Bubble integration before connecting to a production Salesforce org.

Can I sync data bidirectionally between Bubble and Salesforce?

Yes. Bubble → Salesforce is handled by API Connector calls. Salesforce → Bubble can be achieved using Salesforce Outbound Messages or Platform Events that hit a Bubble backend workflow endpoint.

What is the Salesforce API rate limit?

Salesforce API limits depend on your edition. Enterprise Edition allows approximately 100,000 API calls per 24 hours. Monitor usage in Salesforce Setup → Company Information.

Can I query custom Salesforce objects from Bubble?

Yes. Use the same SOQL query pattern with your custom object's API name (ending in __c). For example: SELECT Id, Name FROM My_Custom_Object__c.

How do I handle Salesforce field types in Bubble?

Salesforce dates, numbers, and picklist values come as strings in the JSON response. Use Bubble's :converted to date or :converted to number operators to transform them for display and calculations.

Can RapidDev help with complex Salesforce integrations?

Yes. RapidDev can architect bidirectional Salesforce syncs, handle complex object relationships, build automated data pipelines, and set up error handling for enterprise-grade Salesforce-Bubble integrations.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.