Sync new Primeforge mailboxes to Smartlead every hour

By General Input

Every hour, add newly provisioned Primeforge mailboxes to Smartlead as sending accounts so your outreach platform stays in lockstep with your infrastructure.

Integrations

  • Primeforge
  • Smartlead
  • Google Sheets

Type

Deterministic Code

Categories

  • Sales
  • Operations

Build a code workflow that runs on a cron schedule every hour and syncs newly provisioned Primeforge mailboxes into Smartlead as sending accounts, using a Google Sheet as the sync ledger.

Trigger: cron, hourly.

Steps:

1. Call Primeforge List Workspaces to resolve the target workspace ID. Support either syncing all workspaces the API key can see or a single configured workspace ID as an input parameter.

2. For each workspace, call Primeforge List Workspace Mailboxes to fetch the current mailbox records, including their SMTP and IMAP host, port, username, password, and their deletion status.

3. Read the sync ledger in Google Sheets using Get Values. The ledger is a two-column sheet where column A is the Primeforge mailbox ID and column B is the ISO timestamp it was synced. Both the spreadsheet ID and the tab/range (default 'Log!A:B') should be workflow inputs.

4. Diff the two lists: build the set of already-synced mailbox IDs from column A of the ledger, then produce the list of Primeforge mailboxes whose ID is NOT in that set. Also drop any mailbox whose status indicates it is scheduled for deletion, so we never sync a mailbox that is on its way out.

5. For each remaining new mailbox, call Smartlead Create Email Account with the mailbox's email address, display name, and the SMTP/IMAP host, port, username, and password from the Primeforge record. Use SSL/TLS defaults appropriate to the provider (Google Workspace vs Microsoft 365) based on the mailbox platform field.

6. On a successful create response from Smartlead, call Google Sheets Append Values against the same log range to append a new row with the mailbox ID and the current ISO timestamp. This is what makes the workflow idempotent across runs.

7. If Smartlead returns an error for a specific mailbox (for example, the email already exists in Smartlead), log it, do NOT append to the ledger, and continue with the next mailbox. One failure should not stop the batch.

Inputs the workflow should expose: Primeforge workspace ID (optional, default: all accessible workspaces), Google Sheets spreadsheet ID (required), sheet/range for the ledger (default 'Log!A:B').

Output: a summary object per run with counts of mailboxes discovered, skipped (already synced), skipped (scheduled for deletion), synced successfully, and failed, plus the list of newly synced mailbox IDs.

Notes: Primeforge is not a supported poll provider, so cron plus a diff against the Google Sheets ledger is the intended pattern. Primeforge list endpoints return a flat JSON array and every resource is nested under a workspace. Smartlead's Create Email Account expects SMTP and IMAP host/port/username/password fields.

Related prompts

Explore more prompts
Call overdue Xero customers with an AI collections agentLocal listing health board for every location you manageLet support send one-off Loops emails without an engineerStop cold emails to anyone with a live deal in PipedriveiMessage campaign console with pre-flight checks and delivery boardLinkedIn Ads budget pacing dashboard for every client accountFront desk appointment confirmation board for the next 3 daysGive your team Looker numbers without buying more seatsBuild audience segments from product usage and push to LoopsTurn the people who engage with your posts into Pipedrive leads