Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(warehouse_sources): support omnisend API version 2026-03-15 (#113244)

Tom Owers240a039a9bc8
diff --git a/.agents/skills/warehouse-source-new-version/SKILL.md b/.agents/skills/warehouse-source-new-version/SKILL.md
index dfb21029ad0c..9fcfa1f4a7f4 100644
--- a/.agents/skills/warehouse-source-new-version/SKILL.md
+++ b/.agents/skills/warehouse-source-new-version/SKILL.md
@@ -113,6 +113,7 @@ The opposite gap also occurs: a reference rendered from one version-blind OpenAP
- Other products can read a synced table's columns by name, e.g. a signal emitter registered on `(source_type, table)` in `products/signals/backend/emission/registry.py`. Grep for the source type outside its directory before a new version renames or nests a column such a reader uses, and keep that column under its old name on the new version's rows.
- When the vendor renames a collection between versions, keep the schema/table name set identical across versions and put the rename in a per-version path on the endpoint config — otherwise discovery diffs orphan the table on repin.
- When the new version has no equivalent for an old endpoint (a dropped collection, not a rename), keep that table only on the versions that serve it and let the table set differ by version — never map it to a guessed path just to keep the sets equal, since docs are the sole source of truth and an unverified path makes a new source surface a table that 404s at sync time.
+- The registry catalog invariants (`sources/tests/test_source_catalog_invariants.py`) read only the default version's `get_schemas`, so a new default that drops a table makes that table's canonical description look stray. Keep the description, since pins on the old version still sync and render that table, and add the source to `DESCRIPTIONS_NOT_IN_SCHEMAS`.
- A source with no dispatch may currently read its version from a constant on a shared model (e.g. the OAuth `Integration` model) that also drives version-independent flows like OAuth token minting. Repoint only the sync request path onto the resolved pin; leave that constant, since bumping it changes those other flows' version with a blast radius beyond this source.
- A collection the new version serves only under a parent scope (per team, workspace, or project) instead of account-wide is not a dropped table: keep the table and fan out over the version's parent list endpoint, which the token can also read.
- The opposite holds when the new version is a genuinely different vendor product rather than a renamed collection (the old and new labels serve different endpoints and tables): give the new version its own disjoint table set, don't force the old names onto it. That divergence is safe only because sources are never repinned — so a 2.5→3.0-style move is lossy, and its migration is documented-not-scripted, exactly like a rename that changes primary keys.
diff --git a/products/warehouse_sources/backend/migrations/0179_pin_omnisend_null_api_version_to_v3.py b/products/warehouse_sources/backend/migrations/0179_pin_omnisend_null_api_version_to_v3.py
new file mode 100644
index 000000000000..8bd61e32b12a
--- /dev/null
+++ b/products/warehouse_sources/backend/migrations/0179_pin_omnisend_null_api_version_to_v3.py
@@ -0,0 +1,34 @@
+from django.db import migrations
+
+# Omnisend now defaults to 2026-03-15. That version moves to the `/api` base path with different
+# auth, cursor pagination, renamed primary keys (contactID/campaignID/productID become `id`), prices
+# in currency units instead of cents, and no list endpoints for carts or orders. Moving a source from
+# v3 is lossy, and Omnisend has published no v3 sunset date, so v3 pins are intentionally NOT
+# repinned here.
+#
+# This migration only backs out the NULL cohort from the default flip. A NULL `api_version` resolves
+# to `default_version`, so an Omnisend source created without an explicit pin (direct-ORM/seeder paths
+# that bypass the API's create-time stamping) would silently jump onto 2026-03-15. Pinning those rows
+# to v3 keeps them on the version they were syncing.
+OMNISEND_SOURCE_TYPE = "Omnisend"
+OMNISEND_V3 = "v3"
+
+
+def pin_null_omnisend_rows_to_v3(apps, schema_editor):
+ ExternalDataSource = apps.get_model("warehouse_sources", "ExternalDataSource")
+
+ # Source-level pins only. Filtering on NULL keeps this idempotent and never overwrites an explicit
+ # pin. Schema-level overrides (`ExternalDataSchema.api_version`) are customer-managed and untouched.
+ ExternalDataSource.objects.filter(source_type=OMNISEND_SOURCE_TYPE, api_version__isnull=True).update(
+ api_version=OMNISEND_V3
+ )
+
+
+class Migration(migrations.Migration):
+ dependencies = [("warehouse_sources", "0178_pin_unpinned_buildbetter_sources_to_v1")]
+
+ operations = [
+ # Reverse is a no-op: once pinned, a v3 row is indistinguishable from one natively stamped v3,
+ # so re-nulling would wrongly clear legitimate explicit pins too.
+ migrations.RunPython(pin_null_omnisend_rows_to_v3, migrations.RunPython.noop, elidable=False),
+ ]
diff --git a/products/warehouse_sources/backend/migrations/max_migration.txt b/products/warehouse_sources/backend/migrations/max_migration.txt
index 2a95875ff7eb..3c919c551000 100644
--- a/products/warehouse_sources/backend/migrations/max_migration.txt
+++ b/products/warehouse_sources/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0178_pin_unpinned_buildbetter_sources_to_v1
+0179_pin_omnisend_null_api_version_to_v3
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/api_inventory.md b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/api_inventory.md
index b3953490ff5d..2e1aeaa0759b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/api_inventory.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/api_inventory.md
@@ -3,32 +3,40 @@
Reference for the `omnisend` warehouse source. Verify against the live API before
changing endpoint behavior — see the `implementing-warehouse-sources` skill.
-- **API version:** v3 (`https://api.omnisend.com/v3`). v3 is the stable resource-based
- REST surface for contacts/orders/products/carts/categories/campaigns. (v5 / v2026-03-15
- reshape several of these into event-centric endpoints; v3 is the right fit for a
- list-and-sync warehouse source.)
-- **Auth:** API key in the `X-API-KEY` header.
-- **Pagination:** offset/limit with a fully-formed next-page URL at `paging.next`
- (`null` when exhausted). We follow `paging.next` directly, which makes pagination
- resumable. `limit` default 100, max 250.
+Two API versions are supported. New sources default to `2026-03-15`; `v3` is deprecated by
+Omnisend (no sunset date announced) and existing `v3` pins keep working unchanged.
+
+| | `v3` (deprecated) | `2026-03-15` (default) |
+| --------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------- |
+| Base URL | `https://api.omnisend.com/v3` | `https://api.omnisend.com/api` |
+| Auth | `X-API-KEY: {key}` | `Authorization: Omnisend-API-Key {key}` |
+| Version header | none | `Omnisend-Version: 2026-03-15` (required) |
+| Pagination | `paging.next` full URL | contacts, campaigns: cursor (`paging.cursors.after`, `?after=`); products, categories: `paging.next` full URL |
+| Retired version | — | `410 Gone` |
+
+The same API key works for both versions; only the header changes. `limit` default 100, max 250.
+
- **Rate limits:** 400 req/min general; 100 req/min segment reads; 15 req/min segment
writes. We only read general list endpoints. 429s carry `Retry-After`.
## List endpoints
-| Schema | Path | Response array key | Primary key | Partition (stable) |
-| ---------- | ------------- | ------------------ | ------------ | ------------------ |
-| contacts | `/contacts` | `contacts` | `contactID` | `createdAt` |
-| campaigns | `/campaigns` | `campaign` | `campaignID` | `createdAt` |
-| carts | `/carts` | `carts` | `cartID` | `createdAt` |
-| orders | `/orders` | `orders` | `orderID` | `createdAt` |
-| products | `/products` | `products` | `productID` | `createdAt` |
-| categories | `/categories` | `categories` | `categoryID` | — |
-
-Endpoint existence confirmed against the live API (all return non-404 without a key).
-Primary keys follow Omnisend's `<resource>ID` v3 convention. Response array keys follow
-the plural `<resource>` convention **except `/campaigns`, which nests rows under the
-singular `campaign`** — confirmed against the live response body.
+| Schema | v3 path / key / PK | 2026-03-15 path / key / PK | Partition (stable) |
+| ---------- | ------------------------------------------- | --------------------------------------------------- | ------------------ |
+| contacts | `/contacts` / `contacts` / `contactID` | `/contacts` / `contacts` / `id` | `createdAt` |
+| campaigns | `/campaigns` / `campaign` / `campaignID` | `/campaigns` / `campaigns` / `id` | `createdAt` |
+| carts | `/carts` / `carts` / `cartID` | — (write-only events) | `createdAt` |
+| orders | `/orders` / `orders` / `orderID` | — (write-only events) | `createdAt` |
+| products | `/products` / `products` / `productID` | `/products` / `products` / `id` | `createdAt` |
+| categories | `/categories` / `categories` / `categoryID` | `/product-categories` / `categories` / `categoryID` | — |
+
+v3 endpoint existence was confirmed against the live API (all return non-404 without a key).
+v3 response array keys follow the plural `<resource>` convention **except `/campaigns`, which
+nests rows under the singular `campaign`** (confirmed against the live response body).
+2026-03-15 shapes come from Omnisend's reference and its "Migrate from v3 to v2026-03-15" guide.
+Other 2026-03-15 changes visible in synced rows: product and variant prices are floats in the
+store currency (v3: integer cents), product `images` are URL strings, and campaign statistics
+moved off the campaign object into the Analytics API.
## Sync mode
@@ -43,6 +51,6 @@ key is available, `/contacts` is the candidate to flip to incremental on `update
## Caveats
-- `/orders`: orders that Omnisend auto-syncs from e-commerce platforms (Shopify,
+- `/orders` (v3 only): orders that Omnisend auto-syncs from e-commerce platforms (Shopify,
BigCommerce, WooCommerce) are **not** exposed through v3 — only orders pushed via the
API are returned.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/canonical_descriptions.py
index 5bbc142cd93e..64b2fa5296ef 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/canonical_descriptions.py
@@ -15,6 +15,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"docs_url": "https://api-docs.omnisend.com/reference/get-contacts",
"columns": {
"contactID": "Unique identifier for the contact.",
+ "id": "Unique identifier for the contact.",
"email": "The contact's email address.",
"phone": "The contact's phone number.",
"firstName": "The contact's first name.",
@@ -32,6 +33,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"docs_url": "https://api-docs.omnisend.com/reference/get-campaigns",
"columns": {
"campaignID": "Unique identifier for the campaign.",
+ "id": "Unique identifier for the campaign.",
"name": "The campaign's name.",
"subject": "Subject line of the campaign.",
"fromName": "Sender name shown to recipients.",
@@ -78,6 +80,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"docs_url": "https://api-docs.omnisend.com/reference/get-products",
"columns": {
"productID": "Unique identifier for the product.",
+ "id": "Unique identifier for the product.",
"title": "The product's title.",
"description": "Description of the product.",
"status": "Status of the product (e.g. active, notAvailable).",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/omnisend.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/omnisend.py
index 7502241ac575..69790c7a8ca0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/omnisend.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/omnisend.py
@@ -1,44 +1,133 @@
import dataclasses
from typing import Any, Optional
+from requests import Response
+
from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (
RESTAPIConfig,
rest_api_resource,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (
+ BasePaginator,
+ JSONResponseCursorPaginator,
JSONResponsePaginator,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import ClientConfig
from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager
from products.warehouse_sources.backend.temporal.data_imports.sources.common.source_helpers import validate_via_probe
from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse
-from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import OMNISEND_ENDPOINTS
+from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import (
+ OMNISEND_2026_03_15,
+ OMNISEND_ENDPOINTS,
+ OMNISEND_V3,
+ OmnisendWire,
+)
OMNISEND_BASE_URL = "https://api.omnisend.com/v3"
+OMNISEND_API_BASE_URL = "https://api.omnisend.com/api"
+
+_BASE_URL_BY_VERSION = {
+ OMNISEND_V3: OMNISEND_BASE_URL,
+ OMNISEND_2026_03_15: OMNISEND_API_BASE_URL,
+}
+
+# Raised when a schema is synced on a version that has no list endpoint for it (e.g. a carts
+# schema pinned to 2026-03-15, where carts and orders are write-only events).
+UNSUPPORTED_ENDPOINT_ERROR = "Omnisend API version has no list endpoint for this table"
# Omnisend allows up to 250 items per page; larger pages mean fewer requests against the
# 400 req/min general rate limit.
PAGE_SIZE = 250
[email protected](frozen=True)
class OmnisendResumeConfig:
# Fully-formed next-page URL from the API's `paging.next`; we follow it verbatim.
- next_url: str
+ next_url: Optional[str] = None
+ # Opaque `paging.cursors.after` token for the cursor-paginated 2026-03-15 endpoints.
+ cursor: Optional[str] = None
+
+
+class _OmnisendCursorPaginator(JSONResponseCursorPaginator):
+ def __init__(self) -> None:
+ super().__init__(cursor_path="paging.cursors.after", cursor_param="after", raise_on_repeated_cursor=True)
+
+ def update_state(self, response: Response, data: Optional[list[Any]] = None) -> None:
+ super().update_state(response, data)
+ # Omnisend documents `hasMore: false` and a null `after` cursor as equivalent stop signals.
+ try:
+ has_more = response.json().get("paging", {}).get("hasMore")
+ except Exception:
+ has_more = None
+ if has_more is False:
+ self._has_next_page = False
+
+
+def _base_url(api_version: str) -> str:
+ try:
+ return _BASE_URL_BY_VERSION[api_version]
+ except KeyError:
+ raise ValueError(f"Unsupported Omnisend API version: {api_version}")
+
+def _wire(endpoint: str, api_version: str) -> OmnisendWire:
+ wire = OMNISEND_ENDPOINTS[endpoint].wires.get(api_version)
+ if wire is None:
+ raise ValueError(f"{UNSUPPORTED_ENDPOINT_ERROR}: {endpoint} is not available on {api_version}")
+ return wire
-def _headers() -> dict[str, str]:
- # Auth (X-API-KEY) is supplied via the framework auth config so its value is redacted from
- # logs and raised errors; only the non-secret Accept header is set here.
- return {"Accept": "application/json"}
+
+def _headers(api_version: str) -> dict[str, str]:
+ # Auth is supplied via the framework auth config so its value is redacted from logs and raised
+ # errors; only non-secret headers are set here.
+ headers = {"Accept": "application/json"}
+ if api_version != OMNISEND_V3:
+ headers["Omnisend-Version"] = api_version
+ return headers
+
+
[email protected](frozen=True)
+class _AuthHeader:
+ name: str
+ value: str
+
+
+def _auth_header(api_key: str, api_version: str) -> _AuthHeader:
+ if api_version == OMNISEND_V3:
+ return _AuthHeader(name="X-API-KEY", value=api_key)
+ return _AuthHeader(name="Authorization", value=f"Omnisend-API-Key {api_key}")
+
+
+def _client_config(api_key: str, api_version: str, wire: OmnisendWire) -> ClientConfig:
+ auth = _auth_header(api_key, api_version)
+ paginator: BasePaginator = (
+ _OmnisendCursorPaginator()
+ if wire.cursor_paginated
+ # Omnisend returns a fully-formed next-page URL under `paging.next`; follow it verbatim.
+ else JSONResponsePaginator(next_url_path="paging.next")
+ )
+ return {
+ "base_url": _base_url(api_version),
+ "headers": _headers(api_version),
+ "auth": {"type": "api_key", "api_key": auth.value, "name": auth.name, "location": "header"},
+ "paginator": paginator,
+ # Pin every request, including `paging.next` links and seeded resume URLs, to the Omnisend
+ # host so a tampered link or redirect can't carry the API key elsewhere.
+ "allowed_hosts": [],
+ "allow_redirects": False,
+ "request_timeout": (10, 60),
+ }
-def validate_credentials(api_key: str) -> tuple[bool, int | None]:
+def validate_credentials(api_key: str, api_version: str) -> tuple[bool, int | None]:
"""Cheap probe to confirm the API key is genuine. Returns (is_valid, status_code)."""
+ auth = _auth_header(api_key, api_version)
return validate_via_probe(
lambda: make_tracked_session(redact_values=(api_key,)),
- f"{OMNISEND_BASE_URL}/contacts?limit=1",
- headers={"X-API-KEY": api_key, **_headers()},
+ f"{_base_url(api_version)}/contacts?limit=1",
+ headers={auth.name: auth.value, **_headers(api_version)},
+ allow_redirects=False,
)
@@ -47,25 +136,21 @@ def omnisend_source(
endpoint: str,
team_id: int,
job_id: str,
+ api_version: str,
resumable_source_manager: ResumableSourceManager[OmnisendResumeConfig],
) -> SourceResponse:
config = OMNISEND_ENDPOINTS[endpoint]
+ wire = _wire(endpoint, api_version)
rest_config: RESTAPIConfig = {
- "client": {
- "base_url": OMNISEND_BASE_URL,
- "headers": _headers(),
- "auth": {"type": "api_key", "api_key": api_key, "name": "X-API-KEY", "location": "header"},
- # Omnisend returns a fully-formed next-page URL under `paging.next`; follow it verbatim.
- "paginator": JSONResponsePaginator(next_url_path="paging.next"),
- },
+ "client": _client_config(api_key, api_version, wire),
"resources": [
{
"name": endpoint,
"endpoint": {
- "path": config.path,
+ "path": wire.path,
"params": {"limit": PAGE_SIZE},
- "data_selector": config.data_key,
+ "data_selector": wire.data_key,
# A 200 body missing the envelope key means the response shape changed — fail
# loud instead of silently syncing 0 rows.
"data_selector_required": True,
@@ -78,12 +163,20 @@ def omnisend_source(
if resumable_source_manager.can_resume():
resume = resumable_source_manager.load_state()
if resume is not None:
- initial_paginator_state = {"next_url": resume.next_url}
+ if wire.cursor_paginated and resume.cursor:
+ initial_paginator_state = {"cursor": resume.cursor}
+ # A next-page URL saved under another version points at that version's base path.
+ elif not wire.cursor_paginated and resume.next_url and resume.next_url.startswith(_base_url(api_version)):
+ initial_paginator_state = {"next_url": resume.next_url}
def save_checkpoint(state: Optional[dict[str, Any]]) -> None:
# Persist only when a next page remains; save AFTER a page is yielded so a crash re-yields
# the last page (merge dedupes on the primary key) rather than skipping it.
- if state and state.get("next_url"):
+ if not state:
+ return
+ if state.get("cursor"):
+ resumable_source_manager.save_state(OmnisendResumeConfig(cursor=state["cursor"]))
+ elif state.get("next_url"):
resumable_source_manager.save_state(OmnisendResumeConfig(next_url=state["next_url"]))
resource = rest_api_resource(
@@ -98,7 +191,7 @@ def omnisend_source(
return SourceResponse(
name=endpoint,
items=lambda: resource,
- primary_keys=[config.primary_key],
+ primary_keys=[wire.primary_key],
partition_count=1,
partition_size=1,
partition_mode="datetime" if config.partition_key else None,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/settings.py
index b93d1c14ea85..2b33fad62d8e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/settings.py
@@ -3,13 +3,26 @@ from typing import Optional
from products.warehouse_sources.backend.types import IncrementalField
+OMNISEND_V3 = "v3"
+# Header-versioned (`Omnisend-Version`) on the `/api` base path, with `Authorization: Omnisend-API-Key`.
+OMNISEND_2026_03_15 = "2026-03-15"
-@dataclass
-class OmnisendEndpointConfig:
- name: str
+
+@dataclass(frozen=True)
+class OmnisendWire:
path: str
data_key: str # Response array key, e.g. {"contacts": [...], "paging": {...}}
primary_key: str
+ # Opaque `paging.cursors.after` tokens instead of a fully-formed `paging.next` URL.
+ cursor_paginated: bool = False
+
+
+@dataclass(frozen=True)
+class OmnisendEndpointConfig:
+ name: str
+ # Request shape per supported API version. A version missing here has no list endpoint for
+ # the resource, so the table is not offered on that version.
+ wires: dict[str, OmnisendWire]
# Stable creation-time field used for delta partitioning. Never a mutable field
# like updatedAt — partitions would rewrite on every sync.
partition_key: Optional[str] = None
@@ -21,51 +34,62 @@ class OmnisendEndpointConfig:
OMNISEND_ENDPOINTS: dict[str, OmnisendEndpointConfig] = {
"contacts": OmnisendEndpointConfig(
name="contacts",
- path="/contacts",
- data_key="contacts",
- primary_key="contactID",
+ wires={
+ OMNISEND_V3: OmnisendWire(path="/contacts", data_key="contacts", primary_key="contactID"),
+ OMNISEND_2026_03_15: OmnisendWire(
+ path="/contacts", data_key="contacts", primary_key="id", cursor_paginated=True
+ ),
+ },
partition_key="createdAt",
),
"campaigns": OmnisendEndpointConfig(
name="campaigns",
- path="/campaigns",
- # `/campaigns` is the one v3 list endpoint that nests its rows under the singular
- # `campaign` key; every other resource uses the plural `<resource>` convention.
- data_key="campaign",
- primary_key="campaignID",
+ wires={
+ # `/v3/campaigns` is the one v3 list endpoint that nests its rows under the singular
+ # `campaign` key; every other resource uses the plural `<resource>` convention.
+ OMNISEND_V3: OmnisendWire(path="/campaigns", data_key="campaign", primary_key="campaignID"),
+ OMNISEND_2026_03_15: OmnisendWire(
+ path="/campaigns", data_key="campaigns", primary_key="id", cursor_paginated=True
+ ),
+ },
partition_key="createdAt",
),
"carts": OmnisendEndpointConfig(
name="carts",
- path="/carts",
- data_key="carts",
- primary_key="cartID",
+ wires={OMNISEND_V3: OmnisendWire(path="/carts", data_key="carts", primary_key="cartID")},
partition_key="createdAt",
),
"orders": OmnisendEndpointConfig(
name="orders",
- path="/orders",
- data_key="orders",
- primary_key="orderID",
+ wires={OMNISEND_V3: OmnisendWire(path="/orders", data_key="orders", primary_key="orderID")},
partition_key="createdAt",
),
"products": OmnisendEndpointConfig(
name="products",
- path="/products",
- data_key="products",
- primary_key="productID",
+ wires={
+ OMNISEND_V3: OmnisendWire(path="/products", data_key="products", primary_key="productID"),
+ OMNISEND_2026_03_15: OmnisendWire(path="/products", data_key="products", primary_key="id"),
+ },
partition_key="createdAt",
),
"categories": OmnisendEndpointConfig(
name="categories",
- path="/categories",
- data_key="categories",
- primary_key="categoryID",
+ wires={
+ OMNISEND_V3: OmnisendWire(path="/categories", data_key="categories", primary_key="categoryID"),
+ OMNISEND_2026_03_15: OmnisendWire(
+ path="/product-categories", data_key="categories", primary_key="categoryID"
+ ),
+ },
),
}
ENDPOINTS = tuple(OMNISEND_ENDPOINTS.keys())
+
+def endpoints_for_version(api_version: str) -> tuple[str, ...]:
+ return tuple(name for name, config in OMNISEND_ENDPOINTS.items() if api_version in config.wires)
+
+
INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {
name: config.incremental_fields for name, config in OMNISEND_ENDPOINTS.items()
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/source.py
index 804df6647e97..fec18e476cb8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/source.py
@@ -7,7 +7,11 @@ from products.warehouse_sources.backend.facade.source_config import (
SourceFieldInputConfig,
SourceFieldInputConfigType,
)
-from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import FieldType, ResumableSource
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.base import (
+ FieldType,
+ ResumableSource,
+ VersionDeprecation,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.canonical_descriptions import (
CanonicalDescriptions,
)
@@ -22,21 +26,27 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_
OmnisendSourceConfig,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.omnisend import (
+ UNSUPPORTED_ENDPOINT_ERROR,
OmnisendResumeConfig,
omnisend_source,
validate_credentials as validate_omnisend_credentials,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import (
- ENDPOINTS,
INCREMENTAL_FIELDS,
+ OMNISEND_2026_03_15,
+ OMNISEND_ENDPOINTS,
+ OMNISEND_V3,
+ endpoints_for_version,
)
from products.warehouse_sources.backend.types import ExternalDataSourceType
@SourceRegistry.register
class OmnisendSource(ResumableSource[OmnisendSourceConfig, OmnisendResumeConfig]):
- supported_versions = ("v3",)
- default_version = "v3"
+ supported_versions = (OMNISEND_V3, OMNISEND_2026_03_15)
+ default_version = OMNISEND_2026_03_15
+ # Advisory only: Omnisend has announced no sunset date and still serves v3, so v3 pins stay supported.
+ deprecated_versions = (VersionDeprecation(version=OMNISEND_V3, sunset_at=None),)
api_docs_url = "https://api-docs.omnisend.com"
lists_tables_without_credentials = True # static endpoint catalog — safe for public docs
@@ -89,7 +99,9 @@ You can create an API key in your [Omnisend account settings](https://app.omnise
force_refresh: bool = False,
api_version: str | None = None,
) -> list[SourceSchema]:
- return build_endpoint_schemas(ENDPOINTS, INCREMENTAL_FIELDS, names)
+ return build_endpoint_schemas(
+ endpoints_for_version(self.resolve_api_version(api_version)), INCREMENTAL_FIELDS, names
+ )
def validate_credentials(
self,
@@ -98,7 +110,11 @@ You can create an API key in your [Omnisend account settings](https://app.omnise
schema_name: Optional[str] = None,
api_version: str | None = None,
) -> tuple[bool, str | None]:
- is_valid, status_code = validate_omnisend_credentials(config.api_key)
+ version = self.resolve_api_version(api_version)
+ if schema_name in OMNISEND_ENDPOINTS and schema_name not in endpoints_for_version(version):
+ return False, f"Omnisend API version {version} has no list endpoint for {schema_name}"
+
+ is_valid, status_code = validate_omnisend_credentials(config.api_key, version)
if is_valid:
return True, None
@@ -111,6 +127,8 @@ You can create an API key in your [Omnisend account settings](https://app.omnise
return {
"401 Client Error": "Your Omnisend API key is invalid or expired. Please generate a new key and reconnect.",
"403 Client Error": "Your Omnisend API key does not have the required permissions. Please check the key and try again.",
+ "410 Client Error": "Omnisend has retired the API version this source is pinned to. Please move the source to a supported API version.",
+ UNSUPPORTED_ENDPOINT_ERROR: None,
}
def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[OmnisendResumeConfig]:
@@ -127,5 +145,6 @@ You can create an API key in your [Omnisend account settings](https://app.omnise
endpoint=inputs.schema_name,
team_id=inputs.team_id,
job_id=inputs.job_id,
+ api_version=self.resolve_api_version(inputs.api_version),
resumable_source_manager=resumable_source_manager,
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend.py
index f26e27079360..ef9c4fec17a3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend.py
@@ -8,12 +8,18 @@ from requests import Response
from requests.exceptions import HTTPError
from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.omnisend import (
+ OMNISEND_API_BASE_URL,
OMNISEND_BASE_URL,
+ UNSUPPORTED_ENDPOINT_ERROR,
OmnisendResumeConfig,
omnisend_source,
validate_credentials,
)
-from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import OMNISEND_ENDPOINTS
+from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import (
+ OMNISEND_2026_03_15,
+ OMNISEND_ENDPOINTS,
+ OMNISEND_V3,
+)
# RESTClient builds its session via make_tracked_session in the rest_client module.
CLIENT_SESSION_PATCH = "products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.rest_client.make_tracked_session"
@@ -59,13 +65,24 @@ def _wire(session: mock.MagicMock, responses: list[Response]) -> list[dict[str,
def _prepare(request: Any) -> mock.MagicMock:
snapshots.append({"url": request.url, "params": dict(request.params or {}), "auth": request.auth})
- return mock.MagicMock()
+ # The client's allowed-hosts guard reads `prepared.url`, so it must be a real string.
+ return mock.MagicMock(url=request.url)
session.prepare_request.side_effect = _prepare
session.send.side_effect = responses
return snapshots
+def _source(endpoint: str, manager: mock.MagicMock, api_version: str = OMNISEND_V3):
+ return omnisend_source(
+ "test-key", endpoint, team_id=1, job_id="j", api_version=api_version, resumable_source_manager=manager
+ )
+
+
+def _cursor_page(items: list[dict[str, Any]], after: str | None, has_more: bool, key: str = "contacts") -> Response:
+ return _response({key: items, "paging": {"limit": 250, "hasMore": has_more, "cursors": {"after": after}}})
+
+
def _rows(source_response) -> list[dict[str, Any]]:
return [row for page in source_response.items() for row in page]
@@ -83,7 +100,7 @@ class TestPagination:
)
manager = _make_manager()
- rows = _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ rows = _rows(_source("contacts", manager))
# First request hits the limit-seeded base path; second follows paging.next verbatim.
assert snaps[0]["params"]["limit"] == 250
@@ -105,7 +122,7 @@ class TestPagination:
)
manager = _make_manager()
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
saved = [call.args[0] for call in manager.save_state.call_args_list]
assert saved == [OmnisendResumeConfig(next_url=_next_url(250))]
@@ -116,7 +133,7 @@ class TestPagination:
_wire(session, [_page([{"contactID": "1"}], next_url=None)])
manager = _make_manager()
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
manager.save_state.assert_not_called()
@@ -126,7 +143,7 @@ class TestPagination:
_wire(session, [_response({"contacts": [{"contactID": "1"}]})])
manager = _make_manager()
- rows = _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ rows = _rows(_source("contacts", manager))
assert session.send.call_count == 1
assert rows == [{"contactID": "1"}]
@@ -140,7 +157,7 @@ class TestPagination:
_wire(session, [_page([{"campaignID": "c1"}], next_url=None, key="campaign")])
manager = _make_manager()
- rows = _rows(omnisend_source("test-key", "campaigns", team_id=1, job_id="j", resumable_source_manager=manager))
+ rows = _rows(_source("campaigns", manager))
assert rows == [{"campaignID": "c1"}]
@@ -150,10 +167,59 @@ class TestPagination:
_wire(session, [_page([], next_url=None)])
manager = _make_manager()
- rows = _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ rows = _rows(_source("contacts", manager))
assert rows == []
+ @pytest.mark.parametrize("endpoint", ["contacts", "campaigns"])
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_2026_follows_after_cursor_and_saves_it(self, MockSession, endpoint: str) -> None:
+ session = MockSession.return_value
+ snaps = _wire(
+ session,
+ [
+ _cursor_page([{"id": "1"}], after="c1", has_more=True, key=endpoint),
+ _cursor_page([{"id": "2"}], after=None, has_more=False, key=endpoint),
+ ],
+ )
+
+ manager = _make_manager()
+ rows = _rows(_source(endpoint, manager, OMNISEND_2026_03_15))
+
+ assert snaps[0]["url"] == f"{OMNISEND_API_BASE_URL}/{endpoint}"
+ assert "after" not in snaps[0]["params"]
+ assert snaps[1]["params"]["after"] == "c1"
+ assert rows == [{"id": "1"}, {"id": "2"}]
+ assert [call.args[0] for call in manager.save_state.call_args_list] == [OmnisendResumeConfig(cursor="c1")]
+
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_2026_stops_when_has_more_is_false_even_with_a_cursor(self, MockSession) -> None:
+ session = MockSession.return_value
+ _wire(session, [_cursor_page([{"id": "1"}], after="c1", has_more=False)])
+
+ rows = _rows(_source("contacts", _make_manager(), OMNISEND_2026_03_15))
+
+ assert session.send.call_count == 1
+ assert rows == [{"id": "1"}]
+
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_2026_products_follow_paging_next_on_the_api_base(self, MockSession) -> None:
+ session = MockSession.return_value
+ next_url = f"{OMNISEND_API_BASE_URL}/products?limit=250&offset=250"
+ snaps = _wire(
+ session,
+ [
+ _page([{"id": "p1"}], next_url=next_url, key="products"),
+ _page([{"id": "p2"}], next_url=None, key="products"),
+ ],
+ )
+
+ rows = _rows(_source("products", _make_manager(), OMNISEND_2026_03_15))
+
+ assert snaps[0]["url"] == f"{OMNISEND_API_BASE_URL}/products"
+ assert snaps[1]["url"] == next_url
+ assert rows == [{"id": "p1"}, {"id": "p2"}]
+
class TestResume:
@mock.patch(CLIENT_SESSION_PATCH)
@@ -162,18 +228,38 @@ class TestResume:
snaps = _wire(session, [_page([{"contactID": "6"}], next_url=None)])
manager = _make_manager(OmnisendResumeConfig(next_url=_next_url(500)))
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
assert snaps[0]["url"] == _next_url(500)
manager.load_state.assert_called_once()
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_resume_seeds_cursor_on_2026(self, MockSession) -> None:
+ session = MockSession.return_value
+ snaps = _wire(session, [_cursor_page([{"id": "6"}], after=None, has_more=False)])
+
+ manager = _make_manager(OmnisendResumeConfig(cursor="c5"))
+ _rows(_source("contacts", manager, OMNISEND_2026_03_15))
+
+ assert snaps[0]["params"]["after"] == "c5"
+
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_v3_next_url_is_not_followed_under_2026(self, MockSession) -> None:
+ session = MockSession.return_value
+ snaps = _wire(session, [_page([{"id": "p1"}], next_url=None, key="products")])
+
+ manager = _make_manager(OmnisendResumeConfig(next_url=f"{OMNISEND_BASE_URL}/products?limit=250&offset=500"))
+ _rows(_source("products", manager, OMNISEND_2026_03_15))
+
+ assert snaps[0]["url"] == f"{OMNISEND_API_BASE_URL}/products"
+
@mock.patch(CLIENT_SESSION_PATCH)
def test_does_not_load_state_when_cannot_resume(self, MockSession) -> None:
session = MockSession.return_value
_wire(session, [_page([{"contactID": "1"}], next_url=None)])
manager = _make_manager()
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
manager.load_state.assert_not_called()
@@ -187,7 +273,16 @@ class TestErrors:
manager = _make_manager()
with pytest.raises(HTTPError):
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
+
+ @mock.patch(CLIENT_SESSION_PATCH)
+ def test_off_host_paging_next_is_not_followed(self, MockSession) -> None:
+ session = MockSession.return_value
+ _wire(session, [_page([{"contactID": "1"}], next_url="https://attacker.example.com/contacts?offset=250")])
+
+ with pytest.raises(ValueError, match="disallowed host"):
+ _rows(_source("contacts", _make_manager()))
+ assert session.send.call_count == 1
@mock.patch(CLIENT_SESSION_PATCH)
def test_missing_envelope_key_raises(self, MockSession) -> None:
@@ -197,7 +292,7 @@ class TestErrors:
manager = _make_manager()
with pytest.raises(ValueError, match="matched nothing"):
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager))
@mock.patch("tenacity.nap.time.sleep", return_value=None)
@mock.patch(CLIENT_SESSION_PATCH)
@@ -212,30 +307,47 @@ class TestErrors:
)
manager = _make_manager()
- rows = _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ rows = _rows(_source("contacts", manager))
assert session.send.call_count == 2
assert rows == [{"contactID": "1"}]
class TestAuthAndRedaction:
+ @pytest.mark.parametrize(
+ ("api_version", "base_url", "auth_header", "auth_value", "version_header"),
+ [
+ (OMNISEND_V3, OMNISEND_BASE_URL, "X-API-KEY", "test-key", None),
+ (OMNISEND_2026_03_15, OMNISEND_API_BASE_URL, "Authorization", "Omnisend-API-Key test-key", "2026-03-15"),
+ ],
+ )
@mock.patch(CLIENT_SESSION_PATCH)
- def test_api_key_is_redacted_and_sent_as_header_auth(self, MockSession) -> None:
+ def test_api_key_is_redacted_and_sent_as_header_auth(
+ self,
+ MockSession,
+ api_version: str,
+ base_url: str,
+ auth_header: str,
+ auth_value: str,
+ version_header: str | None,
+ ) -> None:
session = MockSession.return_value
- snaps = _wire(session, [_page([{"contactID": "1"}], next_url=None)])
+ snaps = _wire(session, [_page([{"id": "1"}], next_url=None)])
manager = _make_manager()
- _rows(omnisend_source("test-key", "contacts", team_id=1, job_id="j", resumable_source_manager=manager))
+ _rows(_source("contacts", manager, api_version))
- # The client's session is built with the api_key in redact_values so it's masked in logs
- # and raised errors.
- assert "test-key" in MockSession.call_args.kwargs["redact_values"]
+ # The client's session is built with the sent credential in redact_values so it's masked in
+ # logs and raised errors.
+ assert auth_value in MockSession.call_args.kwargs["redact_values"]
- # The key rides in the X-API-KEY header via framework api_key auth (not a hand-built header).
+ # The key rides in a header via framework api_key auth (not a hand-built header).
auth = snaps[0]["auth"]
- assert auth.name == "X-API-KEY"
+ assert auth.name == auth_header
assert auth.location == "header"
- assert auth.api_key == "test-key"
+ assert auth.api_key == auth_value
+ assert snaps[0]["url"] == f"{base_url}/contacts"
+ assert session.headers.get("Omnisend-Version") == version_header
class TestValidateCredentials:
@@ -246,34 +358,60 @@ class TestValidateCredentials:
@mock.patch(OMNISEND_SESSION_PATCH)
def test_status_mapping(self, mock_session, status_code: int, expected_ok: bool) -> None:
mock_session.return_value.get.return_value = mock.MagicMock(status_code=status_code)
- ok, code = validate_credentials("test-key")
+ ok, code = validate_credentials("test-key", OMNISEND_V3)
assert ok is expected_ok
assert code == status_code
@mock.patch(OMNISEND_SESSION_PATCH)
def test_network_error(self, mock_session) -> None:
mock_session.return_value.get.side_effect = Exception("network down")
- ok, code = validate_credentials("test-key")
+ ok, code = validate_credentials("test-key", OMNISEND_V3)
assert ok is False
assert code is None
+ @pytest.mark.parametrize(
+ ("api_version", "expected_url", "expected_headers"),
+ [
+ (OMNISEND_V3, f"{OMNISEND_BASE_URL}/contacts?limit=1", {"X-API-KEY": "test-key"}),
+ (
+ OMNISEND_2026_03_15,
+ f"{OMNISEND_API_BASE_URL}/contacts?limit=1",
+ {"Authorization": "Omnisend-API-Key test-key", "Omnisend-Version": "2026-03-15"},
+ ),
+ ],
+ )
+ @mock.patch(OMNISEND_SESSION_PATCH)
+ def test_probe_uses_the_versioned_wire(
+ self, mock_session, api_version: str, expected_url: str, expected_headers: dict[str, str]
+ ) -> None:
+ mock_session.return_value.get.return_value = mock.MagicMock(status_code=200)
+ validate_credentials("test-key", api_version)
+
+ call = mock_session.return_value.get.call_args
+ assert call.args[0] == expected_url
+ assert expected_headers.items() <= call.kwargs["headers"].items()
+
class TestSourceResponse:
@pytest.mark.parametrize(
- ("endpoint", "primary_key", "expects_partition"),
+ ("api_version", "endpoint", "primary_key", "expects_partition"),
[
- ("contacts", "contactID", True),
- ("campaigns", "campaignID", True),
- ("carts", "cartID", True),
- ("orders", "orderID", True),
- ("products", "productID", True),
- ("categories", "categoryID", False),
+ (OMNISEND_V3, "contacts", "contactID", True),
+ (OMNISEND_V3, "campaigns", "campaignID", True),
+ (OMNISEND_V3, "carts", "cartID", True),
+ (OMNISEND_V3, "orders", "orderID", True),
+ (OMNISEND_V3, "products", "productID", True),
+ (OMNISEND_V3, "categories", "categoryID", False),
+ (OMNISEND_2026_03_15, "contacts", "id", True),
+ (OMNISEND_2026_03_15, "campaigns", "id", True),
+ (OMNISEND_2026_03_15, "products", "id", True),
+ (OMNISEND_2026_03_15, "categories", "categoryID", False),
],
)
- def test_source_response_shape(self, endpoint: str, primary_key: str, expects_partition: bool) -> None:
- response = omnisend_source(
- "test-key", endpoint, team_id=1, job_id="j", resumable_source_manager=_make_manager()
- )
+ def test_source_response_shape(
+ self, api_version: str, endpoint: str, primary_key: str, expects_partition: bool
+ ) -> None:
+ response = _source(endpoint, _make_manager(), api_version)
assert response.name == endpoint
assert response.primary_keys == [primary_key]
@@ -287,6 +425,11 @@ class TestSourceResponse:
assert response.partition_mode is None
assert response.partition_keys is None
+ @pytest.mark.parametrize("endpoint", ["carts", "orders"])
+ def test_endpoints_without_a_2026_list_endpoint_raise(self, endpoint: str) -> None:
+ with pytest.raises(ValueError, match=UNSUPPORTED_ENDPOINT_ERROR):
+ _source(endpoint, _make_manager(), OMNISEND_2026_03_15)
+
def test_every_endpoint_partition_key_is_stable(self) -> None:
# Partition keys must be creation-time fields, never mutable ones.
for config in OMNISEND_ENDPOINTS.values():
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend_source.py
index d4b0afc0ceb2..79b3602ec3d2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/omnisend/tests/test_omnisend_source.py
@@ -4,6 +4,10 @@ from unittest.mock import patch
from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.omnisend import (
OmnisendSourceConfig,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.settings import (
+ OMNISEND_2026_03_15,
+ OMNISEND_V3,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.source import OmnisendSource
@@ -20,6 +24,52 @@ class TestOmnisendSource:
assert schema.supports_append is False
assert schema.incremental_fields == []
+ @pytest.mark.parametrize(
+ ("api_version", "expected_tables"),
+ [
+ (OMNISEND_V3, {"contacts", "campaigns", "carts", "orders", "products", "categories"}),
+ (OMNISEND_2026_03_15, {"contacts", "campaigns", "products", "categories"}),
+ (None, {"contacts", "campaigns", "products", "categories"}),
+ ],
+ )
+ def test_schemas_follow_the_pinned_version(self, api_version: str | None, expected_tables: set[str]) -> None:
+ schemas = OmnisendSource().get_schemas(_config(), team_id=1, api_version=api_version)
+ assert {schema.name for schema in schemas} == expected_tables
+
+ @pytest.mark.parametrize(
+ ("api_version", "expected_version"),
+ [(OMNISEND_V3, OMNISEND_V3), (OMNISEND_2026_03_15, OMNISEND_2026_03_15), (None, OMNISEND_2026_03_15)],
+ )
+ def test_validate_credentials_probes_the_pinned_version(
+ self, api_version: str | None, expected_version: str
+ ) -> None:
+ with patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.source.validate_omnisend_credentials",
+ return_value=(True, 200),
+ ) as probe:
+ OmnisendSource().validate_credentials(_config(), team_id=1, api_version=api_version)
+ probe.assert_called_once_with("test-key", expected_version)
+
+ @pytest.mark.parametrize(
+ ("api_version", "schema_name", "expected_ok"),
+ [
+ (OMNISEND_2026_03_15, "orders", False),
+ (OMNISEND_V3, "orders", True),
+ (OMNISEND_2026_03_15, "contacts", True),
+ ],
+ )
+ def test_validate_credentials_rejects_tables_the_version_does_not_serve(
+ self, api_version: str, schema_name: str, expected_ok: bool
+ ) -> None:
+ with patch(
+ "products.warehouse_sources.backend.temporal.data_imports.sources.omnisend.source.validate_omnisend_credentials",
+ return_value=(True, 200),
+ ):
+ ok, _ = OmnisendSource().validate_credentials(
+ _config(), team_id=1, schema_name=schema_name, api_version=api_version
+ )
+ assert ok is expected_ok
+
@pytest.mark.parametrize(
("validate_return", "expected_ok", "expected_msg"),
[
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py
index b7719ba3ff04..03fa42a095c6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/tests/test_source_catalog_invariants.py
@@ -33,6 +33,7 @@ DESCRIPTIONS_NOT_IN_SCHEMAS = {
"Giphy",
"GoogleSearchConsole",
"Lovable",
+ "Omnisend",
"OpenWeather",
"Pexels",
"ShipStation",