Keep your stores or dealers in Salesforce, and a sync task imports them on a schedule. Salesforce works with the REST API source and an app in Salesforce that uses the Client Credentials Flow. Store or dealer records are usually Accounts, but any object you can query works. This guide is part of Data Sync; for the add-on itself, see Import & Sync.
You need admin rights in Salesforce. No org to test with? Sign up for a free Developer Edition.
- Choose the User the App Runs As
- Create the App in Salesforce
- Fill in the Connect Step
- Test It
- Map the Fields
- Troubleshooting
Choose the User the App Runs As
With the Client Credentials Flow, the app reads data as one Salesforce user, the “run as” user. Use a user that can read the objects and fields you import. A good choice is a user with the free Salesforce Integration licence and a permission set with API access and read access to Accounts. For a quick test you can use your own admin user.
Create the App in Salesforce
New integrations use an External Client App. At the time of writing, Salesforce no longer lets you create new Connected Apps by default; an existing Connected App with the Client Credentials Flow works the same way.
External Client App
- In Setup, type
External Client App Managerin Quick Find and open it. - Click New External Client App. Enter a name such as
WP Store Locator, your email address as the contact email, and Distribution State Local. - Under API (Enable OAuth Settings), tick Enable OAuth.
- Callback URL:
https://localhost. This flow doesn’t use it, but the field is required. - Selected OAuth Scopes: Manage user data via APIs (api).
- Under Flow Enablement, tick Enable Client Credentials Flow.
- Callback URL:
- Click Create.
- Open the app’s Policies tab and click Edit. Under OAuth Flows, tick Enable Client Credentials Flow and enter the run-as user’s username in Run As (Username). Save.
- On the Settings tab, open OAuth Settings > Consumer Key and Secret. Salesforce may ask for a verification code. Copy the Consumer Key and the Consumer Secret.
Existing Connected App
In Setup > App Manager, edit the app. Under API (Enable OAuth Settings), tick Enable Client Credentials Flow and save. Then click Manage > Edit Policies and set the run-as user under Client Credentials Flow. Copy the Consumer Key and Secret from View > Manage Consumer Details.
Your My Domain
Your org’s address is in Setup > My Domain, for example acme.my.salesforce.com. The Client Credentials Flow only works on that address, not on login.salesforce.com.
Fill in the Connect Step
Start a new sync task, choose REST API and fill in:
| Field | What to enter |
|---|---|
| Name | Filled in for you as “REST API (Salesforce) – …” with today’s date once you enter the API URL. Change it if you like. |
| API URL | https://acme.my.salesforce.com/services/data/v62.0/query?q=SELECT Id, Name, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, Phone, Website FROM Account |
| Login | OAuth 2.0 |
| Token URL | https://acme.my.salesforce.com/services/oauth2/token |
| Client ID | The Consumer Key |
| Client secret | The Consumer Secret |
| Scope, Username (optional), Password (optional) | Leave them empty. |
acme with your My Domain in both addresses.You can use a later API version than v62.0. Spaces in the query are fine. To import only some accounts, add a WHERE clause, for example WHERE Type = 'Dealer'. To skip geocoding, add BillingLatitude, BillingLongitude to the query if your accounts have them.

Test It
Click Test connection. It says how many accounts the query returns, such as “Connected. 86 rows found.” Under Advanced settings you then see:
- Path to the stores:
records - Paging: Next link
- Path to the next link:
nextRecordsUrl
Salesforce sends a long result in pages, with a nextRecordsUrl to the next one. A run follows those links until it has every record. It checks the total against Salesforce’s totalSize, and fails instead of importing part of the list if records are missing.
Map the Fields
On the Map fields step, the columns of the query above are mapped for you:
| Salesforce field | Store field |
|---|---|
Id |
External ID. The record’s ID never changes, so a renamed account is still found. |
Name |
Store Name |
BillingStreet |
Address |
BillingCity |
City |
BillingState |
State |
BillingPostalCode |
Zip Code |
BillingCountry |
Country |
Phone |
Phone |
Website |
URL |
Salesforce’s attributes field is left out. Shipping fields, such as ShippingStreet, are matched the same way; when you query both, the first one in the query is mapped. Check each row, and pick the store field yourself for your own custom fields.
Troubleshooting
| Message | What it means and what to do |
|---|---|
| The token URL refused the login: invalid_grant — …. | Check that Enable Client Credentials Flow is ticked on the Policies tab, that a Run As user is set, and that the token URL uses your My Domain address, not login.salesforce.com. |
| The token URL refused the login: invalid_client — …. | The Consumer Key or Consumer Secret is wrong. Copy them again from the app. A new app can take a few minutes before it works. |
| The API answered with HTTP 400. followed by Salesforce’s reason | The query has a mistake, such as a field name that doesn’t exist on the object. The reason names it. |
| The API refused the login (403). Check the login details. | The run-as user may not use the API or read the object. Check its licence and permission set. |
| The API returned no stores. | The query returns no records. Check the WHERE clause, and that the run-as user can see the records. |
Next
- Import options, the schedule and email reports: Data Sync.
- More REST API messages: REST API troubleshooting. Messages that aren’t about Salesforce: Data Sync troubleshooting.