Sync FTP file leads to Marketo via HTTP

UtilitiesDeveloperAPIMarketing

What it does

When a new file lands in Brick FTP, this automation downloads it and parses the CSV. It refreshes the Marketo token, searches for existing leads via HTTP, and deletes or creates them as needed.

Who it's for

Marketing operations teams who sync lead lists from FTP to Marketo when the Marketo connector lacks a required endpoint.

How teams use this

Sync leads when Marketo lacks the endpoint

Use Rest to call a new Marketo API that the Marketo connector does not yet support. The automation handles token refresh and lead search so the sync works without waiting for a connector update.

Delete leads not in the source file

Call the Marketo delete endpoint via HTTP for leads that exist in Marketo but are missing from the FTP file. Add a condition to check if the lead ID is present but not in the file before deleting.

Automate lead sync from a different source

Replace Brick FTP with another file storage system and keep the same HTTP logic for Marketo. The token refresh and lead search steps remain unchanged.

Check token expiration before each HTTP call

Add a condition to check the Marketo token age before each HTTP call and refresh only when needed. This reduces API calls and ensures the sync never fails due to an expired token.

How it works

  1. Monitor for new files in Brick FTP. Detect when a new file arrives in Brick FTP so the sync can begin without manual intervention or delay.
  2. Refresh Marketo token via HTTP. Call the Marketo token endpoint via HTTP and refresh the access token, which expires every 60 minutes, so subsequent API calls authenticate.
  3. Download and parse the CSV file. Retrieve the CSV file from Brick FTP and parse it into individual lead records so each row can be processed in the loop.
  4. Search leads and delete via HTTP. For each lead in the file, search Marketo via HTTP. If the lead exists, delete it via HTTP since that delete capability is not in the Marketo connector.
  5. Create new leads in Marketo. Add leads that were not found in Marketo so the database stays current with the FTP file and no duplicates exist.