Sync InfraForge mailboxes to Smartlead every night

By General Input

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

Integrations

  • InfraForge
  • Smartlead
  • Slack Bot

Type

Deterministic Code

Categories

  • Sales
  • Operations

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.

Related prompts

Explore more prompts
A brand asset library your marketing team actually searchesTurn Mailjet email clicks into ranked HubSpot follow-upsClean out the Looker dashboards and Looks nobody opensLiveKit live operations console for room moderationWake up dormant Keap leads with a researched reasonLiveChat coverage board for planning next week's shiftsPhone routing control panel for LiveKit voice agentsLinkedIn Ads budget pacing dashboard for every client accountGive your team Looker numbers without buying more seatsPause marketing emails to escalated customers, then restore them