Sync new Primeforge mailboxes to Smartlead every hour
Every hour, add newly provisioned Primeforge mailboxes to Smartlead as sending accounts so your outreach platform stays in lockstep with your infrastructure.
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.
Additional information
What does this prompt do?
- Checks your Primeforge workspace every hour for mailboxes that have not been added to Smartlead yet.
- Adds each new mailbox to Smartlead as a sending account using the SMTP and IMAP details from Primeforge.
- Keeps a running log in a Google Sheet of every mailbox that has already been synced, so nothing gets added twice.
- Skips any Primeforge mailbox that is scheduled for deletion so you never send from a mailbox that is on its way out.
What do I need to use this?
- A Primeforge account with mailboxes provisioned in a workspace.
- A Smartlead account you can add sending accounts to.
- A Google account and a Google Sheet with a tab that will hold the sync log (two columns: mailbox ID and synced-at timestamp).
How can I customize it?
- Change how often it runs. Hourly is the default, but you can move it to every 15 minutes for fast-turnaround agencies or once a day if you only provision in batches.
- Filter which mailboxes get synced. Restrict by workspace, domain, or setup so different clients land in different Smartlead accounts.
- Point the log at a different sheet or tab. Any two-column sheet where the first column is the mailbox ID will work as the ledger.
Frequently asked questions
Why not just add mailboxes to Smartlead manually?
What happens if a mailbox is already in Smartlead?
Will it sync mailboxes that are scheduled for deletion?
Can I use this with more than one Smartlead account?
Do I need to prepare the Google Sheet in advance?
Related templates
Stop leaving new mailboxes stranded outside Smartlead.
Connect Primeforge, Smartlead, and a Google Sheet once, and Geni keeps the two platforms in sync every hour.