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 products, tasks and custom fields to planhat (#126776)

Tom Owers327727e5b391
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 efd67dd59521..04de4566a0e9 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
@@ -9570,12 +9570,12 @@ Diffed against: <https://docs.planhat.com/developers/api/planhat-models>
- [x] `sale` — closed revenue transactions (high)
- [x] `churn` — churn records, the headline customer-success metric (high)
- [x] `metrics` — time-series usage and health metrics per company; Planhat's central analytical object (high)
-- [ ] `product` — lookup resolving the product IDs carried on synced licenses and on line items (high)
+- [x] `product` — lookup resolving the product IDs carried on synced licenses and on line items (high)
- [x] `line-item` — line-level breakdown of licenses, invoices and sales (high)
- [x] `opportunity` — open pipeline against existing accounts (high)
-- [ ] `user-activities` — enduser activity events, the raw input to adoption analysis (medium)
-- [ ] `custom-field` — lookup describing the custom fields present on companies, endusers and licenses (medium)
-- [ ] `task` — CSM task records for workload and playbook execution (medium)
+- [ ] `user-activities` — enduser activity events, the raw input to adoption analysis (medium); skipped: the User Activities API only ingests events (POST to analytics.planhat.com) and has no list endpoint to read them back
+- [x] `custom-field` — lookup describing the custom fields present on companies, endusers and licenses (medium)
+- [x] `task` — CSM task records for workload and playbook execution (medium)
Note: docs.planhat.com is now a Framer SPA that serves the same HTML shell for every path, so the page list is not readable by plain curl. I recovered the authoritative model list from the site's own search index (https://framerusercontent.com/sites/2dYA2Fo9WB6PMbsWedNqce/searchIndex-RF4JY9qKBv0J.json), which serializes the /developers/api/\* page titles and the full model nav on the planhat-models page. Also documented but omitted as lower value: issue, objective, project, campaign, deal, time-entry, timesheet.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/canonical_descriptions.py
index 31fd7378aa22..cb6795a21876 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/canonical_descriptions.py
@@ -239,6 +239,73 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"sourceId": "The ID of the line item in an integration such as Salesforce or HubSpot.",
},
},
+ "products": {
+ "description": "A subscription plan or one-off fee you sell. Line items inherit their default values from the product.",
+ "docs_url": "https://docs.planhat.com/developers/api/product",
+ "columns": {
+ "_id": "The unique ID of the product.",
+ "name": "The product name.",
+ "externalId": "Your own identifier for the product.",
+ "sourceId": "The ID of the product in an integration such as Salesforce or HubSpot.",
+ "type": "The product type: subscription or fee.",
+ "mrr": "The default monthly recurring revenue of the product.",
+ "arr": "The default annual recurring revenue of the product, calculated from mrr.",
+ "value": "The default value of the product, used as the main revenue field for fees.",
+ "currency": "The default currency of the product.",
+ "fixedPeriod": "Whether line items for the product have a fixed end date by default.",
+ "autoRenews": "Whether line items for the product renew automatically by default.",
+ "length": "The default subscription length in months.",
+ "renewalMrr": "The default expected monthly recurring revenue at renewal.",
+ "renewalArr": "The default expected annual recurring revenue at renewal.",
+ "renewalPeriod": "The default renewal period length in months.",
+ "noticePeriod": "The default notice period length.",
+ "noticeUnit": "The unit of the notice period: day, week or month.",
+ "packages": "The names of the packages the product belongs to.",
+ "custom": "Custom properties set on the product.",
+ "createdAt": "When the product was created.",
+ "updatedAt": "When the product was last updated.",
+ },
+ },
+ "tasks": {
+ "description": "An open task or calendar event for a customer. Planhat archives a task when it is completed, so completed tasks are not included.",
+ "docs_url": "https://docs.planhat.com/developers/api/task",
+ "columns": {
+ "_id": "The unique ID of the task.",
+ "mainType": "The main type of the task: task, or event for calendar events.",
+ "companyId": "The ID of the company the task belongs to.",
+ "companyName": "The name of the company the task belongs to.",
+ "action": "The title of the task, for example Send invoice.",
+ "description": "The description of the task.",
+ "type": "The type of task.",
+ "startTime": "When the task starts.",
+ "endTime": "When the task ends.",
+ "dateDone": "When the task was completed.",
+ "repeat": "How often the task repeats: daily, weekly, monthly, quarterly, yearly or custom.",
+ "repeatDays": "The number of days between repeats, for a custom repeat interval.",
+ "ownerId": "The ID of the Planhat user who owns the task.",
+ "ownerName": "The name of the Planhat user who owns the task.",
+ "doneBy": "The ID of the Planhat user who completed the task.",
+ },
+ },
+ "custom_fields": {
+ "description": "A custom field defined on a Planhat model, such as companies, end users or licenses.",
+ "docs_url": "https://docs.planhat.com/developers/api/custom-field",
+ "columns": {
+ "_id": "The unique ID of the custom field.",
+ "name": "The name of the custom field.",
+ "type": "The field type, for example number, text, date, list or team member.",
+ "parent": "The Planhat model the custom field belongs to.",
+ "isFeatured": "Whether the field shows in the detail view of its parent.",
+ "isHidden": "Whether the field is hidden from every view of its parent.",
+ "isShared": "Whether the field can be shared on the portal.",
+ "isLocked": "Whether the field cannot be edited in the Planhat app.",
+ "isMandatory": "Whether the field is required to create its parent.",
+ "isFormula": "Whether the field is a formula field.",
+ "formula": "The formula definition of a formula field.",
+ "listValues": "The options of a list or multipicklist field.",
+ "numberFormat": "The number format of a number field.",
+ },
+ },
"metrics": {
"description": "A time-series metric value (dimension data) recorded for a company or another model on a given day.",
"docs_url": "https://docs.planhat.com/developers/api/metrics",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/settings.py
index 215ef62d1f89..1f2cd655998d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/settings.py
@@ -29,6 +29,10 @@ PLANHAT_ENDPOINTS: dict[str, PlanhatEndpointConfig] = {
"churn": PlanhatEndpointConfig(name="churn", path="/churn"),
"opportunities": PlanhatEndpointConfig(name="opportunities", path="/opportunities"),
"line_items": PlanhatEndpointConfig(name="line_items", path="/lineitems"),
+ "products": PlanhatEndpointConfig(name="products", path="/products"),
+ # Planhat archives a task once it is completed, and the list endpoint returns only unarchived tasks by default.
+ "tasks": PlanhatEndpointConfig(name="tasks", path="/tasks"),
+ "custom_fields": PlanhatEndpointConfig(name="custom_fields", path="/customfields"),
# Planhat calls metrics "dimension data". The `from`/`to` day filters apply to the metric's `time`,
# not to when it was written, and backfilled values land on past days, so it stays full refresh too.
"metrics": PlanhatEndpointConfig(name="metrics", path="/dimensiondata"),
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/source.py
index 555a84e0f0b4..651e75bfdbe3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/source.py
@@ -56,7 +56,7 @@ class PlanhatSource(ResumableSource[PlanhatSourceConfig, PlanhatResumeConfig]):
releaseStatus=ReleaseStatus.GA,
caption="""Enter your Planhat API access token to pull your customer success data into the PostHog Data warehouse.
-You can create an API access token from a Private App under **Settings → Service Accounts** in [Planhat](https://app.planhat.com). The token is shown once, so copy it immediately. It grants read access to your companies, end users, users, licenses, assets, NPS responses, conversations, tickets, invoices, sales, churn, opportunities, line items, and metrics.
+You can create an API access token from a Private App under **Settings → Service Accounts** in [Planhat](https://app.planhat.com). The token is shown once, so copy it immediately. It grants read access to your companies, end users, users, licenses, assets, NPS responses, conversations, tickets, invoices, sales, churn, opportunities, line items, products, tasks, custom fields, and metrics.
""",
iconPath="/static/services/planhat.png",
docsUrl="https://posthog.com/docs/cdp/sources/planhat",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/tests/test_planhat.py b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/tests/test_planhat.py
index e2c9e574894a..afadefe6d205 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/tests/test_planhat.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/planhat/tests/test_planhat.py
@@ -111,6 +111,9 @@ class TestPlanhatSourceResponse:
("churn", "/churn"),
("opportunities", "/opportunities"),
("line_items", "/lineitems"),
+ ("products", "/products"),
+ ("tasks", "/tasks"),
+ ("custom_fields", "/customfields"),
("metrics", "/dimensiondata"),
]
)