> For the complete documentation index, see [llms.txt](https://docs.spara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spara.com/integrations/crm-integrations/marketo.md).

# Marketo

How Spara integrates with Marketo.

Spara supports bidirectional data syncs with Marketo.

For sending data to Marketo, Spara supports:

* Writing entire conversation histories
* Writing structured data, ex. the answer a lead gives to a specific question

Syncing data from Marketo to Spara streamlines your buyer's sales process by:

* Spara never reasks a question
* Spara's behavior can react to each lead based on where they are in your sales funnel
* Syncs can be triggered at any point in the conversation

### Authentication

{% hint style="info" %}
You must be a Manager-level user to manage third party integrations. You will likely want the individual who manages your Marketo deployment to complete these instructions.
{% endhint %}

Click the "Organization Settings" link in the left hand navigation bar. Then click the "Integrations" tab.

Click "Authorize" within the Marketo module. This will lead you through an authentication flow. There are no further steps necessary upon completing this flow. You should see that Marketo is "Enabled" within Spara's Integrations page.

The Marketo API user you connect with needs a role that has these permissions (Marketo **Admin > Users & Roles**):

* **Read-Write Lead**, to match, create, and update Leads
* **Read-Only Activity**, to read Lead changes so Spara can pull updates from Marketo

If the role is missing one of these, Marketo refuses the call. Spara then records a "Marketo denied Spara's lead pull" entry in your sync log and keeps retrying every few minutes, so syncing resumes on its own once the permission is granted.

### Data Syncing

Spara will automatically sync all conversation data to matching `Lead` objects in Marketo. This includes the full conversation history.

Spara matches data based on supplied [Developer: Query Parameters](https://docs.spara.com/developers/spara-api/query-parameters). As soon as an email is captured in the Spara chat, Spara attempts to match the `email` field to a Marketo `Lead` object with an identical email property. Data continues to sync throughout the conversation.

To sync additional fields, open a field in the [**Data Model**](https://app.spara.co/data-model) and map it to a Marketo `Lead` field in its **Marketo sync** section. Each mapping has a write rule per direction (**Marketo → Spara** and **Spara → Marketo**): **Overwrite**, **Set if empty**, or **Read-only**. See [Data Model](/build/data-model.md#crm-field-mappings).

Linked Leads stay in sync both ways. Spara pushes field changes to the Marketo Lead right away, and pulls changes from Marketo every few minutes, each according to the field's write rule. When Marketo is first connected, the initial pull covers Leads created in Marketo in the last 30 days.

The Marketo settings page shows a read-only **Fields synced to/from CRM** list, with mapping problems first and **Manage in Data Model** to edit them.

### Import Rules

Import Rules control which existing Marketo Leads are imported into Spara as new Leads. This is useful for leads that exist in Marketo but have not yet interacted with a Spara agent. Spara can import them so your agents and workflows can proactively reach out. Import Rules can filter on any Marketo Lead field; by default, Spara only imports Leads that have an email address. The **Import Leads** toggle on the [**Marketo settings page**](https://app.spara.co/settings/integrations/marketo/manage) turns importing on or off.

Import Rules only decide which Leads become new Spara Leads. They don't affect how Leads already linked to a Spara Lead sync; that is controlled by the **Sync Leads** toggle above them.

{% hint style="info" %}
Import Rules are configured by your Spara customer success representative.
{% endhint %}

### Recognizing returning visitors

If your site runs Marketo's Munchkin tracking script, Spara recognizes visitors Marketo already knows. When a visitor opens the Spara chat, Spara reads the Munchkin `_mkto_trk` cookie and looks up the matching Marketo `Lead`. If the lead has an email, Spara fills in their email, name, company and any mapped fields, so the agent doesn't ask for information you already have.

This turns on automatically once Marketo is connected. There's nothing else to set up.

* Only visitors Marketo has already identified are recognized. Anonymous visitors go through the normal conversation.
* Anything the visitor has already provided to Spara is never overwritten.
* If you use Spara's cookie consent integration, the cookie isn't read until the visitor consents.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.spara.com/integrations/crm-integrations/marketo.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
