Data & connectors
Connect Salesforce
Connecting Salesforce is two jobs, and they are done by different people at different times.
- An Admin registers Weft in your org, once. You create an app on the Salesforce side and paste its credentials into Weft.
- Each person authorizes with their own login. Queries then run as that person, under their own permissions.
The second part is quick and is the one most people see. The first part is a one-time setup and is described in full below.
Connections exist only in the hosted app (signed in to a workspace). In local mode, Settings → Integrations shows a note instead.
Weft never asks for a Salesforce password, and never stores one. Authorization happens on Salesforce's own consent screen; Weft holds only a refresh token.
Part 1 — register Weft in Salesforce (Admin, once)
In Weft, registering a connection needs the Admin or Owner role. (Editors see the connection and authorize their own login on it, but cannot register or remove one; viewers see a note.) In Salesforce you need permission to create an External Client App (or Connected App), or someone who has it beside you.
Start in Weft:
- Open Settings — the gear button in the app bar — and choose Integrations.
- Press Register connection. If your workspace offers both Salesforce and HubSpot, choose Salesforce under Provider.
The form opens with a checklist headed First, in Salesforce (once per org). It shows Weft's callback URL with a Copy button. If you close Settings while you work in Salesforce, press Register connection again; the URL is the same.
In Salesforce:
- In Setup, open External Client App Manager and create a New External Client App. If your org still allows Connected Apps, one works the same way.
- Enable OAuth and set the Callback URL to Weft's callback URL, exactly as Weft shows it. This is the address Salesforce returns to after someone approves consent; a mismatch here is the single most common cause of a failed connection.
- Select exactly these two OAuth scopes: Manage user data via APIs (api), to query the records your templates read, and Perform requests at any time (refresh_token, offline_access), to stay connected without signing in again.
- Save. On the app's Settings tab, open OAuth Settings and reveal the Consumer Key and Secret — Salesforce may ask you to verify your identity — then copy both.
Salesforce can take a few minutes to start using a new app. If the first authorization attempt fails immediately, wait and try again before changing anything.
Back in Weft:
- Enter a Connection name your team will recognise — Acme Salesforce, or the org name if you have several.
- Paste the Consumer Key (client_id) and Consumer Secret (client_secret). They are stored encrypted.
- Press Save connection.
The connection now appears in the list, but nobody has authorized it yet — including you.
Part 2 — authorize with your own login
Everyone who works with live Salesforce data needs their own authorization, because Weft runs each query as the person asking. You do it in the same place whatever your role.
Authorize your login
On the connection's row in Settings → Integrations, press Connect.
- A new tab opens on Salesforce's consent screen. Approve it there.
- The tab shows Connected — your data source is authorized. and closes itself. Your Weft tab stays where it was, with the connection's row highlighted.
Admins, Owners and Editors all see the same rows and the same Connect button; only Admins and Owners also see Register connection and Remove. If you registered the connection, connect it too: shared access on a Salesforce PDF button reads Salesforce through your authorization, as the section on whose permissions apply explains below.
If Salesforce isn't available in Weft right now, each Salesforce row says Salesforce isn't available right now and has no Connect button. Your connections and their settings are kept, and Connect returns when Salesforce does.
An editor can also connect the first time they click a Salesforce PDF button — see Add a Salesforce PDF button. On a template set to Each user connects their own Salesforce (the default), the button shows Connect Salesforce to continue; connecting there serves the editor's other work on the same connection too.
Until you have connected, the data-source builder, live data, and previews and exports that use a data source fail for you with "the acting user has not authorized this connection".
Connecting to a sandbox
Tick Sandbox on the connection's row before pressing Connect — the checkbox is on each
row, for anyone connecting a Salesforce login. Weft then sends you to test.salesforce.com
instead of the production login. The box starts unticked each time, so tick it whenever you
connect to a sandbox from Settings.
The first time anyone connects a connection successfully, Weft remembers which login page worked. The PDF button's Connect Salesforce has no Sandbox box: it uses that remembered page. So once one person has connected a sandbox connection from Settings with Sandbox ticked, teammates who connect from the PDF button go to the sandbox login too. Until anyone has, it uses the production login.
Each person's authorization points at one org at a time: connecting again, to production or a sandbox, replaces their previous one.
Whose permissions apply
This is worth being precise about, because it decides what your documents can contain.
Each person's authorization is their own. Previews, live data and exports run the query with the login of the person doing them — so a rep sees the accounts a rep can see, and nothing else. Salesforce's sharing rules, field-level security and profile permissions all continue to apply exactly as they do in the Salesforce UI.
There is one exception, and it covers the Salesforce PDF button only. An Admin can switch a template's button to shared access, so that every click reads Salesforce through the authorization of the person who registered the connection — see Add a Salesforce PDF button. Previews and exports in the editor always use your own login.
The practical consequence: if a field is blank in a rendered document but populated in Salesforce, check the permissions of the login the query ran under first. It is a far more common cause than a broken binding.
Verify it works
With a template open, open the data pill — the button in the bar directly above your document that names the data you are previewing. Choose Build a data source, or Manage sources… and then New data source if the template already has one. If the template has unsaved changes, Weft saves it first, because a data source belongs to a saved template.
Pick the connection under Connection, then an object and a couple of fields, and press Preview rows. If records come back, the connection is live for you.
See Build a data source for the whole flow.
Troubleshooting
"redirect_uri_mismatch" on Salesforce's page — the Callback URL in your Salesforce app does not exactly match Weft's. It must match character for character, including scheme and any trailing path.
"the provider wouldn't exchange the authorization" — Weft could not finish the sign-in with the app's credentials. Check that the app has both OAuth scopes, then connect again. If the Consumer Key or Secret was pasted wrongly, remove the connection and register it again: a saved connection cannot be edited.
"Please allow pop-ups for this site, then click Connect again." — your browser blocked the consent tab. Allow pop-ups for Weft and press the button again.
"this connection wasn't started from this browser" — the consent was approved in a different browser from the one where Connect was pressed, so Weft discarded it. Press Connect again and approve in the tab it opens.
"the acting user has not authorized this connection" — you have not connected your own login yet. Part 2 above shows where to connect.
Records missing from a preview — almost always sharing rules or field-level security on the authorizing user, not Weft. Check the same query as that user in Salesforce.
Removing a connection
An Admin or Owner presses Remove on the connection's row, then Remove again in the Remove this connection? dialog. This deletes its stored credentials and every person's authorization on it. Templates whose data sources use it stop loading data, so check what uses it first.
A saved data source cannot switch to another connection, so after replacing a connection, build those data sources again on the new one and publish the affected templates again — see Publish a template.
What next
- Choose which records a template reads → Build a data source
- Put those values into the page → Bind fields