Iterable
Trigger an Iterable campaign template for one recipient, with message content delivered as dataFields.
Capabilities
| Repeated headers | Idempotency | Scheduling | Personalized |
|---|---|---|---|
| No | none |
No | expanded |
These values come from the adapter’s exported capabilities declaration. The field support matrix covers normalized message fields.
The Iterable adapter calls Iterable’s target email API with plain fetch. It works differently from most adapters: instead of sending raw content, it triggers an existing campaign template for exactly one recipient and hands your message to the template as dataFields.
Configure
Create a server-side API key in Iterable and copy the campaign ID of the template you want to trigger.
import { createEmailClient } from "@opencoredev/email-sdk";
import { iterable } from "@opencoredev/email-sdk/iterable";
export const email = createEmailClient({
adapters: [
iterable({
apiKey: process.env.ITERABLE_API_KEY!,
campaignId: Number(process.env.ITERABLE_CAMPAIGN_ID!),
}),
],
});
apiKeystring
Iterable API key.
stringcampaignIdnumber
Campaign whose template renders the email. Non-numeric values throw an EmailValidationError when the adapter is created.
numberallowRepeatMarketingSends?boolean
Forwarded to Iterable to allow re-sending a marketing campaign to the same user.
booleandataFields?EmailMetadataRecord | (message) => EmailMetadataRecord
Extra template fields, as a static object or a function of the message. Merged in before the normalized fields, so subject/html/text/from win on conflicts.
EmailMetadataRecord | (message) => EmailMetadataRecordsendAt?string
Schedule the send. UTC timestamp in Iterable's expected format. This adapter option is separate from the message-level sendAt field, which Iterable rejects.
stringbaseUrl?string
Override the API origin, e.g. for a proxy.
string"https://api.iterable.com"fetch?typeof fetch
Custom fetch implementation for tests or special runtimes.
typeof fetchSend
The campaign template renders the email. The adapter passes subject, html, text, and from into dataFields so the template can use them, and forwards metadata as Iterable webhook metadata.
const result = await email.send({
from: "Acme <hello@acme.com>",
to: "user@example.com",
subject: "Your trial ends in 3 days",
html: "<p>Upgrade to keep your workspace.</p>",
metadata: { userId: "user_123" },
});
console.log(result.raw); // Iterable returns no message id; inspect the raw response
Verify from the CLI
ITERABLE_API_KEY="..." ITERABLE_CAMPAIGN_ID="12345" npx --package @opencoredev/email-sdk email-sdk doctor --adapter iterable
ITERABLE_API_KEY="..." npx --package @opencoredev/email-sdk email-sdk send \
--adapter iterable \
--campaign-id 12345 \
--from "Acme <hello@acme.com>" \
--to user@example.com \
--subject "Iterable smoke test" \
--text "It works" \
--dry-run
--campaign-id and --iterable-send-at override ITERABLE_CAMPAIGN_ID and ITERABLE_SEND_AT. Iterable’s adapter option is separate from the message-level --send-at flag because this adapter does not support Email SDK scheduled messages. Drop --dry-run to trigger one real campaign send and confirm the API key and campaign are live.
Frequently asked questions
Does Email SDK support Iterable?
Yes. Email SDK ships a Iterable adapter imported from @opencoredev/email-sdk/iterable. You keep your Iterable account and credentials; the SDK adds message validation, typed errors, and no-network test adapters around the same send() call used for every other provider.
Which message fields does the Iterable adapter support?
Iterable supports Metadata. It does not support CC recipients, BCC recipients, Reply-To address, Custom headers, Attachments, Tags, and Scheduled sending (sendAt); Email SDK rejects a message that uses those fields before any request is made.
Can Iterable schedule email for later with Email SDK?
No. Iterable has no provider-side scheduling, so a message with sendAt fails validation. Store the job in your own queue and send when it is due.
Does the Iterable adapter support idempotent sends?
No. Iterable has no provider-side idempotency, so a retried send can be delivered twice. A send with idempotencyKey on a route that includes Iterable fails with EmailValidationError unless you pass idempotency: “best-effort”. Deduplicate in your own queue before retrying.