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.
The prompt
Paste it into a new chat in General Input, and a specialist builds it with you.
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.
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.
Make it yours
- 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.