Skip to main content

Salesforce Marketing Cloud integration

This guide walks you through connecting Salesforce Marketing Cloud (SFMC) to Better Email, from creating the API package in SFMC to optionally syncing recipient fields for merge tags and segmentation.

Before you start

To connect SFMC, you will need:

  • A Salesforce Marketing Cloud account with access to Setup and Installed Packages
  • Permission to create an installed package with a server-to-server API integration
  • An admin user in Better Email who can create and edit integrations
note

Better Email connects to SFMC using the client_credentials flow. There is no user login, callback URL, or refresh token involved.

1. Create the API package in Salesforce Marketing Cloud

In Salesforce Marketing Cloud:

  1. Go to Setup.
  2. Open Installed Packages.
  3. Create a new package, for example Better Email.
  4. Add a component of type API Integration.
  5. Choose Server-to-Server.

SFMC will generate the credentials Better Email needs:

  • Client ID
  • Client Secret
  • Tenant-specific API endpoints

Important:

  • The package component must be Server-to-Server, not another integration type.
  • The package must remain installed and enabled in the SFMC account or business unit your team is using.
  • If you later rotate the client secret in SFMC, update the secret in Better Email too.

2. Copy the values Better Email needs

From the installed package, copy these values into Better Email:

  • Client ID
  • Client Secret
  • Your tenant subdomain
  • Optional: your target business unit MID / account_id

For the subdomain, use only the tenant identifier, not the full URL.

Example:

  • Auth Base URI: https://mc563885gzs27c5t9-63k636ttgm.auth.marketingcloudapis.com
  • Subdomain to enter in Better Email: mc563885gzs27c5t9-63k636ttgm

If Better Email shows an SFMC authorization error right away when exporting or fetching field sources, double-check these three values first. A wrong subdomain, stale client secret, or package that is not enabled in the correct SFMC account can all cause token requests to fail before any export or field sync happens.

If the installed package is enabled only for a specific SFMC business unit, also copy that business unit's MID and enter it in Better Email as Business Unit MID (optional). Better Email sends this value as account_id when requesting the SFMC access token so the token is issued in the correct business unit context.

3. Enable the required SFMC permissions

Use these scopes as the baseline for the integration:

  • saved_content_read
  • saved_content_write
  • documents_and_images_read
  • documents_and_images_write
  • email_read
  • email_write
  • data_extensions_read

If you also want Better Email to access SFMC tracking and performance data, add:

  • tracking_events_read
note

If you plan to sync recipient fields from SFMC into Better Email, data_extensions_read is required. In practice, email_read is also needed for fetching Contact Builder field sources. Depending on how your SFMC account is structured, you may also need access to the relevant Contact Builder and Data Extension resources used by your team.

4. Set up the integration in Better Email

In Better Email:

  1. Go to Integrations.
  2. Create a new integration.
  3. Enter a name for the integration.
  4. Choose Salesforce Marketing Cloud as the type.
  5. Optional: under Access, restrict the integration to specific users or groups in your organization.
  6. Save the integration.
  7. After saving, fill in:
    • Subdomain
    • Client ID
    • Client Secret
    • Business Unit MID (optional) if the package is enabled only for a specific business unit
  8. Enable the integration.
  9. Save the integration again.

If you leave Access open, the integration is available to everyone in the organization. If you restrict it, only the selected users or groups, plus admins, will be able to use it in Better Email.

You can also optionally configure:

  • Only show categories under these parent IDs
  • Default subject
  • Default preheader
  • Minify

Only show categories under these parent IDs limits the folder picker during export so users only see categories under specific SFMC parent folders. Enter a comma-separated list of SFMC category IDs if you want to restrict users to a specific part of the Content Builder folder tree. Leave it blank to show all categories.

Once saved, Better Email can request access tokens from SFMC as needed and export email assets into Content Builder.

5. Optional: define export subject lines and preheaders in the email editor

By default, users enter the Subject and Preheader in the SFMC export dialog when they export an email.

If you want those values to come from the email's global settings instead, set Default subject and Default preheader on the SFMC integration to reference the relevant email setting fields.

For example:

  • Default subject: {{ template.sender_settings.subjectline }}
  • Default preheader: {{ template.sender_settings.previewtext }}
SFMC integration settings with default subject and preheader references

With this setup:

  1. The subject line and preheader are managed from the email editor instead of being typed manually at export time.
  2. When the export dialog opens, Better Email resolves the configured references from the email settings.
  3. If those settings have values, the export dialog shows the resolved subject line and preheader from the email.
SFMC export dialog showing subject and preheader pulled from email settings

This is useful when subject lines and preheaders should be defined as part of the email itself, while still being exported into Salesforce Marketing Cloud.

6. Optional: sync recipient fields from SFMC

Better Email can sync recipient fields from Salesforce Marketing Cloud so they can be used for merge tags and segmentation.

Turn on recipient field sync

  1. Open the SFMC integration in Better Email.
  2. Turn on Sync recipient fields.
  3. Save the integration.

Choose which Contact Builder attribute sets to sync

After saving the integration:

  1. Click Fetch available field sources.
  2. Better Email loads the available Contact Builder attribute sets from SFMC.
  3. Select the attribute sets you want to sync.
  4. Save the integration again.

If no attribute sets are selected, Better Email treats that as "sync all available attribute sets".

This step uses Salesforce Marketing Cloud's Contact Builder attribute set API. It can fail even when email export works, because export uses Content Builder endpoints while field-source fetching depends on access to Contact Builder resources for the relevant SFMC account or business unit. In our testing, a package that could export successfully still failed here until email_read was added.

The selector shows:

  • Attribute set name
  • Source key
  • Field count
  • Whether the attribute set is marked as sendable in SFMC

Important to know:

  • Fetch available field sources currently fetches Contact Builder attribute sets from SFMC, not Data Extensions.
  • A source shown as Sendable means the attribute set has isSendable set in SFMC.
  • The Sendable badge does not mean the item is a Data Extension.
  • If SFMC returns Account / User not authorized for operation, the installed package can authenticate successfully but still lack the Contact Builder access needed for this endpoint.
  • If export works but Fetch available field sources fails, add email_read first, then verify the package has access to the correct SFMC account or business unit.

Run the field sync in Better Email

Once recipient field sync is enabled:

  1. Go to Recipient Fields.
  2. Click Sync from <integration name>.
  3. Better Email imports the selected fields and creates or updates recipient fields for that integration.

7. Optional: sync fields from a sendable Data Extension

Better Email can also sync fields from a sendable Data Extension when a sendable_data_extension_key is configured for the integration.

Use this when you want recipient fields to come from a specific sendable Data Extension in addition to, or instead of, Contact Builder attributes.

Current behavior:

  • Contact Builder attribute set selection is available in the Better Email integration UI.
  • Data Extension syncing is not currently part of the Fetch available field sources picker.
  • Data Extension syncing still depends on the integration having a sendable_data_extension_key configured.
  • If no Data Extension key is configured, Better Email syncs only Contact Builder attribute fields.

If you want to sync Data Extensions instead of, or alongside, Contact Builder attribute sets, collect the relevant sendable Data Extension IDs or keys and share them with the Better Email team so the integration can be configured correctly.

If your team uses segmentation, recipient-field syncing, or merge tags heavily, test all three flows early after connecting SFMC so you catch permissions or business-unit issues before your first live export.

For most teams, the smoothest setup looks like this:

  1. Start with the Contact Builder attribute sets you actually need.
  2. Limit the sync to the relevant sets instead of syncing everything.
  3. Add a sendable Data Extension key only when you specifically need Data Extension-based fields in Better Email.

If you are unsure which SFMC sources to use, start with the smallest set that supports your merge tags and segmentation needs, then expand from there.