> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gradial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce Marketing Cloud

> Connect Gradial to Salesforce Marketing Cloud to build emails, organize campaigns, and orchestrate journeys from a single flow.

Connect Marketing Cloud once and Gradial can build emails, organize campaigns, and orchestrate journeys — with reviewers able to click straight from a Gradial artifact back into the Marketing Cloud UI whenever they want to finish in their familiar tool.

***

## What You Can Do

<CardGroup cols={2}>
  <Card title="Email content" icon="envelope">
    Browse Content Builder folders. Draft new emails from chat — HTML, text-only, or from a template. Update subject lines, preheaders, and body content. Preview the rendered email inline before sending.
  </Card>

  <Card title="Campaigns" icon="flag">
    Create campaigns with names, codes, and color tags. List, view, and delete campaigns. Attach or remove email assets from a campaign. Open any campaign straight in the Marketing Cloud UI.
  </Card>

  <Card title="Journeys" icon="diagram-project">
    View existing journeys. Draft new journeys from built-in templates: single email, drip, decision split, and random split. Update activity wiring, copy, wait durations, and decision criteria. Publish journeys when ready.
  </Card>

  <Card title="Templates" icon="file-code">
    Read existing templates so Gradial can reference them when drafting new emails. Template authoring stays in the SFMC UI for now.
  </Card>
</CardGroup>

***

## Prerequisites

* Admin access to your Salesforce Marketing Cloud account
* Permission to create **Installed Packages** in Marketing Cloud
* Your Marketing Cloud subdomain (found in your account URL)
* A Gradial organization **Administrator** role to complete setup

***

## How to Connect

<Steps>
  <Step title="Create an Installed Package in Marketing Cloud">
    1. Log in to Salesforce Marketing Cloud.
    2. Navigate to **Setup → Platform Tools → Apps → Installed Packages**.
    3. Click **New**, enter a name (e.g., `Gradial`) and description, then click **Save**.
  </Step>

  <Step title="Add a Server-to-Server API component">
    1. In the newly created package, click **Add Component → API Integration**.
    2. Choose **Server-to-Server** and click **Next**.
    3. Grant the scopes the team needs:

    | Category                 | Permission                 | Required |
    | ------------------------ | -------------------------- | -------- |
    | **Email**                | Read, Write, Send, Publish | Yes      |
    | **Documents and Images** | Read, Write                | Yes      |
    | **Campaign**             | Read, Write                | Yes      |
    | **Journeys**             | Read, Write, Execute       | Yes      |
    | **Event Definitions**    | Read                       | Yes      |
    | **Data Extensions**      | Read                       | Optional |
    | **Tracking Events**      | Read                       | Optional |

    4. Click **Save**.
  </Step>

  <Step title="Copy your credentials">
    From the Installed Package details page, copy:

    * **Client ID**
    * **Client Secret**
    * **Authentication Base URI** (e.g., `https://mcXXXXXX.auth.marketingcloudapis.com`)
    * **Account ID (MID)** — the business unit's Member ID

    <Warning>
      Keep the Client Secret secure. If you navigate away, it will be hidden. You can regenerate it, but doing so will invalidate any existing integrations using the old secret.
    </Warning>
  </Step>

  <Step title="Add the integration in Gradial">
    1. In Gradial, go to **Settings → Integrations**.
    2. Find **Salesforce Marketing Cloud** and click **+ Add**.
    3. Fill in the connection details:

    | Field                  | Value                                                                               |
    | ---------------------- | ----------------------------------------------------------------------------------- |
    | **Integration Name**   | A display name (e.g., `Acme Marketing Cloud — Production BU`)                       |
    | **SFMC Auth Base URL** | Your Authentication Base URI (e.g., `https://mcXXXXXX.auth.marketingcloudapis.com`) |
    | **Client ID**          | From step 3                                                                         |
    | **Client Secret**      | From step 3                                                                         |
    | **Account ID (MID)**   | The business unit's Member ID                                                       |

    4. Click **Save**. Gradial validates the credentials before the integration goes live.
    5. *(Optional)* Choose a default Content Builder folder for new email assets.
  </Step>

  <Step title="Assign to an Environment">
    1. Go to **Settings → Environments** and select the Gradial Environment where SFMC should be available.
    2. Add the integration to that Environment.
    3. Repeat for any additional Environments.
  </Step>
</Steps>

***

## How It Fits Into Broader Workflows

| Use case                            | How to use it                                                                                                                                                               |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Email to campaign in one thread** | Draft the email and attach it to a campaign in the same Gradial thread that produced the brief or copy                                                                      |
| **Journey authoring**               | Plan welcome, drip, and A/B journeys end-to-end from chat — entry source, emails, wait durations, branches, publish                                                         |
| **Inline QA**                       | Use Gradial's inline email preview to QA the rendered email; click into Marketing Cloud from a campaign or journey artifact when reviewers want the SFMC canvas             |
| **Cross-integration workflows**     | Combine SFMC with DAM, asset search, image generation, and content gen so a single thread can produce the creative, place it in Content Builder, and drop it into a journey |

**Example — Build and attach an email to a campaign:**

1. Ask Gradial to find (or create) the right Content Builder folder.
2. Have Gradial draft a new email — subject line, preheader, and body copy.
3. Ask Gradial to create a campaign with a name and code.
4. Attach the new email to the campaign in the same turn.
5. Open the campaign artifact and click into Marketing Cloud when the team is ready to launch.

**Example — Draft a welcome journey:**

1. Ask Gradial to list the available entry sources.
2. Pick one of the bundled templates — single email, drip, decision split, or random split.
3. Tell Gradial which email to send, how long to wait, and how to branch.
4. Publish the journey when it's ready.

***

## What's Not Covered Yet

* Stopping, pausing, or republishing a journey — only the initial publish is supported from Gradial.
* Authoring new entry-source event definitions — Gradial can see them, not create them.
* Activity types beyond Email, Wait, Decision Split, and Random Split (SMS, Push, Update Contact, etc.).
* Automation Studio workflows.
* Template authoring.

***

## Multi-Business Unit Configuration

**Parent-Level Access** — Create one Installed Package at the Parent Business Unit level with access to all child Business Units. Use the Parent MID when configuring Gradial.

**Business Unit-Specific Access** — Create separate Installed Packages for each Business Unit that requires isolation. Configure multiple integrations in Gradial, one per Business Unit.

***

## Troubleshooting

| Issue                           | Cause                                | Solution                                    |
| ------------------------------- | ------------------------------------ | ------------------------------------------- |
| `invalid_client` error          | Incorrect Client ID or Secret        | Verify credentials in the Installed Package |
| `unauthorized` error            | Package lacks required permissions   | Add missing scopes to the API component     |
| `invalid_request` error         | Incorrect subdomain or Auth URI      | Check the Authentication Base URI           |
| `insufficient_privileges` error | MID doesn't match package assignment | Verify the MID and Business Unit access     |

***

## Good to Know

* **Inline previews are safe to share**: Gradial renders email previews through a server-side proxy that strips unsafe HTML.
* **Campaign updates are narrow**: Marketing Cloud's campaign API only allows a small set of updates. To rename or recolor a campaign, delete and recreate it through Gradial, or edit it in the Marketing Cloud UI.
* **Publishing a journey is asynchronous**: once Gradial publishes, Marketing Cloud takes a moment to transition the journey through its internal states.

***

## Support

Contact your Gradial onboarding lead or email [support@gradial.com](mailto:support@gradial.com) for help with setup.
