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 4 missing tables to the Teamtailor source (#118550)

Tom Owersa1dbd1b38318
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 f4516dfac47f..323a31f3e5e1 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
@@ -12001,10 +12001,10 @@ Today (5): `candidates`, `departments`, `job_applications`, `jobs`, `users`
Diffed against: <https://docs.teamtailor.com/api/collections/14157246/TVzSiGxA>
-- [ ] `stages` — pipeline stage lookup resolving the stage each job_application sits in — without it application data has no funnel (high)
-- [ ] `movements` — candidate stage-transition history — the fact table for time-in-stage and conversion analysis (high)
-- [ ] `reject-reasons` — lookup resolving the rejection reason IDs on job applications (high)
-- [ ] `locations` — location lookup for the jobs we already sync; standard hiring breakdown dimension (high)
+- [x] `stages` — pipeline stage lookup resolving the stage each job_application sits in — without it application data has no funnel (high)
+- [x] `movements` — candidate stage-transition history — the fact table for time-in-stage and conversion analysis (high)
+- [x] `reject-reasons` — lookup resolving the rejection reason IDs on job applications (high)
+- [x] `locations` — location lookup for the jobs we already sync; standard hiring breakdown dimension (high)
- [ ] `job-offers` — offer records with status — the bottom of the hiring funnel (medium)
- [ ] `interviews` — scheduled interview events per application, needed for interview-load and scheduling metrics (medium)
- [ ] `scorecard-scores` — per-criterion interview ratings — the structured evaluation data (medium)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/canonical_descriptions.py
index ee9693125082..a1408530a163 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/canonical_descriptions.py
@@ -73,4 +73,60 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"updated-at": "When the department was last updated.",
},
},
+ "stages": {
+ "description": "A pipeline stage of a job. Each job application sits in one stage of its job.",
+ "docs_url": "https://docs.teamtailor.com/",
+ "columns": {
+ "id": "The unique ID of the stage.",
+ "type": "The JSON:API resource type (always 'stages').",
+ "name": "The stage name.",
+ "legacy-stage-type-name": "Legacy stage type: Inbox, In process, or Hired.",
+ "row-order": "The value that Teamtailor uses to sort the stages of a job.",
+ "active-job-applications-count": "The number of active job applications in the stage.",
+ "rejected-job-applications-count": "The number of rejected job applications in the stage.",
+ "created-at": "When the stage was created.",
+ "updated-at": "When the stage was last updated.",
+ },
+ },
+ "movements": {
+ "description": "A move of a job application from one stage to another stage.",
+ "docs_url": "https://docs.teamtailor.com/",
+ "columns": {
+ "id": "The unique ID of the movement.",
+ "type": "The JSON:API resource type (always 'movements').",
+ "from-stage-id": "The ID of the stage the job application moved from.",
+ "to-stage-id": "The ID of the stage the job application moved to.",
+ "is-rejected": "Whether the movement is a rejection.",
+ "created-at": "When the movement was created.",
+ "updated-at": "When the movement was last updated.",
+ },
+ },
+ "reject_reasons": {
+ "description": "A reason that a job application was rejected.",
+ "docs_url": "https://docs.teamtailor.com/",
+ "columns": {
+ "id": "The unique ID of the reject reason.",
+ "type": "The JSON:API resource type (always 'reject-reasons').",
+ "reason": "The text of the reject reason.",
+ "rejected-by-company": "True when the company gave the reason, false when the candidate gave it.",
+ },
+ },
+ "locations": {
+ "description": "A location (office) of the company in Teamtailor.",
+ "docs_url": "https://docs.teamtailor.com/",
+ "columns": {
+ "id": "The unique ID of the location.",
+ "type": "The JSON:API resource type (always 'locations').",
+ "name": "The location name, when the city is not sufficient.",
+ "address": "The street address.",
+ "city": "The city name.",
+ "zip": "The postal code.",
+ "country": "The full country name.",
+ "headquarters": "Whether this is the main location of the company.",
+ "lat": "The decimal latitude of the location.",
+ "long": "The decimal longitude of the location.",
+ "email": "The contact email address.",
+ "phone": "The contact phone number.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/settings.py
index ae327a4dc527..d761791c5740 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/settings.py
@@ -22,6 +22,10 @@ TEAMTAILOR_ENDPOINTS: dict[str, TeamtailorEndpointConfig] = {
"job_applications": TeamtailorEndpointConfig(name="job_applications", path="/job-applications"),
"users": TeamtailorEndpointConfig(name="users", path="/users"),
"departments": TeamtailorEndpointConfig(name="departments", path="/departments"),
+ "stages": TeamtailorEndpointConfig(name="stages", path="/stages"),
+ "movements": TeamtailorEndpointConfig(name="movements", path="/movements"),
+ "reject_reasons": TeamtailorEndpointConfig(name="reject_reasons", path="/reject-reasons"),
+ "locations": TeamtailorEndpointConfig(name="locations", path="/locations"),
}
ENDPOINTS = tuple(TEAMTAILOR_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
index e1908e414413..c78eec993cb5 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/source.py
@@ -60,7 +60,7 @@ class TeamtailorSource(ResumableSource[TeamtailorSourceConfig, TeamtailorResumeC
releaseStatus=ReleaseStatus.ALPHA,
caption="""Enter your Teamtailor API key to pull your recruiting data into the PostHog Data warehouse.
-You can create an API key under **Settings → API keys** in Teamtailor. The key grants read access to your candidates, jobs, job applications, users, and departments.
+You can create an API key under **Settings → API keys** in Teamtailor. Use a key with the **Admin** scope and **read** access. It lets PostHog read your candidates, jobs, job applications, stages, stage movements, reject reasons, users, departments, and locations.
""",
iconPath="/static/services/teamtailor.png",
docsUrl="https://posthog.com/docs/cdp/sources/teamtailor",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor.py b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor.py
index b09c8450c26e..5af280d0dfb7 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/teamtailor/tests/test_teamtailor.py
@@ -156,13 +156,29 @@ class TestCheckAccess:
class TestTeamtailorSourceResponse:
- @parameterized.expand([(e,) for e in ENDPOINTS])
- def test_source_response_shape(self, endpoint: str) -> None:
- response = _driver().run(endpoint, always(_page([]))).response
+ @parameterized.expand(
+ [
+ ("candidates", "/v1/candidates"),
+ ("jobs", "/v1/jobs"),
+ ("job_applications", "/v1/job-applications"),
+ ("users", "/v1/users"),
+ ("departments", "/v1/departments"),
+ ("stages", "/v1/stages"),
+ ("movements", "/v1/movements"),
+ ("reject_reasons", "/v1/reject-reasons"),
+ ("locations", "/v1/locations"),
+ ]
+ )
+ def test_source_response_shape(self, endpoint: str, expected_path: str) -> None:
+ result = _driver().run(endpoint, always(_page([{"id": "1"}])))
+ response = result.response
assert response is not None
assert response.name == endpoint
assert response.primary_keys == ["id"]
assert response.partition_mode is None
+ # Table names use underscores, but Teamtailor paths are kebab-case.
+ assert result.paths == [expected_path]
+ assert result.rows == [{"id": "1"}]
def test_every_endpoint_uses_id_primary_key(self) -> None:
assert all(config.primary_keys == ["id"] for config in TEAMTAILOR_ENDPOINTS.values())