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(data-warehouse): add 2 missing tables to the SpotlerCRM source (#119663)

Tom Owers0dc5506b015a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 1434a1a5473b..7d618f2f3f13 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -11573,8 +11573,8 @@ Today (9): `Accounts`, `Activities`, `Campaigns`, `Cases`, `Contacts`, `Document
Diffed against: <https://support.reallysimplesystems.com/api-v4/>
-- [ ] `campaignstages` — lookup table resolving the stage a campaign or campaign member sits in (high)
-- [ ] `campaigndetails` — the per-campaign membership/detail rows linking contacts to campaigns (high)
+- [x] `campaignstages` — lookup table resolving the stage a campaign or campaign member sits in (high)
+- [x] `campaigndetails` — the per-campaign membership/detail rows linking contacts to campaigns (high)
Note: The v4 API documents exactly 11 CRUD objects; PostHog exposes 9 of them, so coverage is nearly complete. The two missing ones are both marketing-tool objects. Also available but not table-shaped: GET /datadictionary/{object} and GET /lookup/{object}/{field} for dropdown values.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/canonical_descriptions.py
index 6250bfc9e210..01b3fb8aa82a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/canonical_descriptions.py
@@ -58,6 +58,20 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"sales": "Sales value attributed to the campaign.",
},
},
+ "CampaignDetails": {
+ "description": "Campaign membership rows that link records to campaigns. Requires the Spotler CRM Marketing tool add-on.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the campaign detail row.",
+ },
+ },
+ "CampaignStages": {
+ "description": "Stages that campaigns and campaign members move through. Requires the Spotler CRM Marketing tool add-on.",
+ "docs_url": _DOCS_URL,
+ "columns": {
+ "id": "Unique identifier for the campaign stage.",
+ },
+ },
"Cases": {
"description": "Customer service cases. Requires the Spotler CRM Service & Support tool add-on.",
"docs_url": _DOCS_URL,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/settings.py
index 7af2199fe29a..4057cb28d6a8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/settings.py
@@ -17,6 +17,8 @@ SPOTLERCRM_ENDPOINTS: dict[str, SpotlerCRMEndpoint] = {
"Accounts": SpotlerCRMEndpoint(name="Accounts", path="/accounts", partition_key="createddate"),
"Activities": SpotlerCRMEndpoint(name="Activities", path="/activities", partition_key="createddate"),
"Campaigns": SpotlerCRMEndpoint(name="Campaigns", path="/campaigns"),
+ "CampaignDetails": SpotlerCRMEndpoint(name="CampaignDetails", path="/campaigndetails"),
+ "CampaignStages": SpotlerCRMEndpoint(name="CampaignStages", path="/campaignstages"),
"Cases": SpotlerCRMEndpoint(name="Cases", path="/cases", partition_key="createddate"),
"Contacts": SpotlerCRMEndpoint(name="Contacts", path="/contacts", partition_key="createddate"),
"Documents": SpotlerCRMEndpoint(name="Documents", path="/documents"),
@@ -36,6 +38,8 @@ ENDPOINT_DESCRIPTIONS: dict[str, str] = {
"Accounts": "Companies and organizations stored in the CRM.",
"Activities": "Tasks, calls, meetings, and other activities logged against records.",
"Campaigns": "Marketing campaigns. Requires the Spotler CRM Marketing tool add-on.",
+ "CampaignDetails": "Campaign membership rows that link records to campaigns. Requires the Spotler CRM Marketing tool add-on.",
+ "CampaignStages": "Stages that campaigns and campaign members move through. Requires the Spotler CRM Marketing tool add-on.",
"Cases": "Customer service cases. Requires the Spotler CRM Service & Support tool add-on.",
"Contacts": "People linked to accounts.",
"Documents": "Documents attached to CRM records.",
@@ -48,5 +52,7 @@ ENDPOINT_DESCRIPTIONS: dict[str, str] = {
# permanently fail for accounts without the add-on.
ENDPOINT_SHOULD_SYNC_DEFAULT: dict[str, bool] = {
"Campaigns": False,
+ "CampaignDetails": False,
+ "CampaignStages": False,
"Cases": False,
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/source.py
index fe8d8c9ddfc9..436ad082fec4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/source.py
@@ -121,7 +121,7 @@ class SpotlerCRMSource(ResumableSource[SpotlerCRMSourceConfig, SpotlerCRMResumeC
Generate a token in Spotler CRM under **Settings / Integrations / API V4** — it's shown only once, so copy it when you create it.
-Some record types need paid add-ons: Campaigns requires the Marketing tool, and Cases requires the Service & Support tool.""",
+Some record types need paid add-ons: Campaigns, Campaign details and Campaign stages require the Marketing tool, and Cases requires the Service & Support tool.""",
docsUrl="https://posthog.com/docs/cdp/sources/spotlercrm",
iconPath="/static/services/spotlercrm.png",
keywords=["really simple systems", "spotler", "rss crm"],
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/tests/test_spotlercrm.py b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/tests/test_spotlercrm.py
index ff31f0edae5e..aa784fe4bdcf 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/tests/test_spotlercrm.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/spotlercrm/tests/test_spotlercrm.py
@@ -53,9 +53,17 @@ class TestSpotlerCRMSourceBehavior:
config = SpotlerCRMSourceConfig(access_token="test-token")
return SourceDriver(SpotlerCRMSource(), config).run(endpoint, script, resume_state=resume_state)
- def test_fresh_run_pages_forward_and_checkpoints_after_each_page(self) -> None:
+ @pytest.mark.parametrize(
+ ("endpoint", "expected_path"),
+ [
+ ("Accounts", "/accounts"),
+ ("CampaignDetails", "/campaigndetails"),
+ ("CampaignStages", "/campaignstages"),
+ ],
+ )
+ def test_fresh_run_pages_forward_and_checkpoints_after_each_page(self, endpoint: str, expected_path: str) -> None:
result = self._drive(
- "Accounts",
+ endpoint,
[
_page([{"id": 1}], has_more=True),
_page([{"id": 2}], has_more=True),
@@ -63,6 +71,7 @@ class TestSpotlerCRMSourceBehavior:
],
)
+ assert result.paths == [expected_path] * 3
assert result.params("page") == ["1", "2", "3"]
assert result.params("limit") == ["100", "100", "100"]
assert result.items == [[{"id": 1}], [{"id": 2}], [{"id": 3}]]