# Sync InfraForge mailboxes to Smartlead every night

> Every night at 2am, add any newly provisioned InfraForge mailboxes to Smartlead as sending accounts so they are ready for tomorrow's campaigns.

- Workflow type: code
- Services: InfraForge, Smartlead, Slack Bot
- Categories: Sales, Operations
- Published: 2026-07-08

## What it does

- Runs on its own every night at 2am and checks your InfraForge workspace for mailboxes that are not yet in Smartlead.
- Adds each missing mailbox to Smartlead as a sending account, wiring up the sending and receiving credentials automatically.
- Optionally attaches every newly created account to a target Smartlead campaign so it starts sending on day one.
- Posts a short summary to Slack with how many accounts were added and flags anything that failed.

## What you'll need

- An InfraForge account with an API key and a workspace where you provision mailboxes.
- A Smartlead account with an API key where the sending accounts should live.
- A Slack workspace where the nightly summary should be posted.
- Optional: a Smartlead campaign ID if you want new mailboxes attached automatically.

## Prompt

Build a code workflow that runs every night at 2am (workspace local time) and syncs newly provisioned InfraForge mailboxes into Smartlead as sending accounts. This is a deterministic pipeline. No LLM reasoning nodes.

Trigger: cron, daily at 02:00.

Configurable inputs on the workflow:

- infraforge_workspace_id: the InfraForge workspace to sync mailboxes from.

- smartlead_campaign_id: optional. When set, newly created Smartlead sending accounts are attached to this campaign.

- slack_channel: Slack channel or user id to post the summary to.

Steps:

1. Call infraforge: List Mailboxes scoped to the configured workspace_id, with with_credentials=true so SMTP and IMAP credentials come back in the response.

2. Call smartlead: List Email Accounts to fetch the current sending accounts in the Smartlead workspace.

3. Diff the two lists by email address (case-insensitive, trimmed). Build a list of InfraForge mailboxes whose email is not already present in Smartlead.

4. For each mailbox in the missing list, call smartlead: Create Email Account using the SMTP host, port, username, password, and IMAP host, port, username, password returned by InfraForge. Also carry over the from-name and any signature if provided. Collect the created email_account_ids and any per-mailbox failures.

5. If smartlead_campaign_id is set and at least one account was created successfully, call smartlead: Add Email Account to Campaign with the campaign id and the list of newly created email_account_ids.

6. Call slackbot: Send a Message to the configured Slack channel with a one-line summary: how many accounts were added, whether they were attached to a campaign, and any failures (with the offending email addresses and the error message).

Implementation notes: Use the slackbot integration (bot token) for the notification, not the user slack integration. Wrap each per-mailbox Create Email Account call so a single failure does not abort the whole run. Retry transient 429/5xx errors with a short backoff. Always post the Slack summary at the end, even when nothing was added, so operators know the job ran.

## How to customize

- Change the schedule. Run it every few hours, on a different time, or only on weekdays.
- Pick which InfraForge workspace to sync from, or run one copy per workspace if you keep clients separated.
- Set a target Smartlead campaign so new mailboxes start sending immediately, or leave it off to add them unassigned.
- Change where the summary lands. Post it to a private ops channel, a client channel, or a direct message.

## FAQ

### Will this create duplicates if a mailbox is already in Smartlead?

No. Before adding anything the workflow reads your existing Smartlead sending accounts, matches them against InfraForge by email address, and only creates the mailboxes that are missing.

### Do I need to have SMTP and IMAP passwords ready?

No. The workflow pulls the sending and receiving credentials directly from InfraForge for every new mailbox and hands them to Smartlead, so you never touch a CSV.

### Can I run it without a target campaign?

Yes. If you leave the campaign setting empty, new mailboxes are added to Smartlead as sending accounts and left unassigned so you can attach them later by hand.

### What happens if InfraForge or Smartlead is unreachable when it runs?

The next nightly run picks up whatever is still missing, so a bad night just delays those mailboxes by one day. Nothing gets lost.

### Does the Slack summary include failures?

Yes. The message shows how many accounts were added, whether they were attached to a campaign, and calls out any mailboxes that could not be created so you can retry them.

Use this prompt in General Input: https://www.generalinput.com/prompts/sync-infraforge-mailboxes-to-smartlead-every-night