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(servicem8): add material, tax rate, staff time event and feedback tables (#129994)

Tom Owers3a5ba2bacd0b
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 0db71cd03682..7e5bcb2ec3a5 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
@@ -10890,13 +10890,13 @@ Today (10): `Attachment`, `Category`, `Company`, `CompanyContact`, `Job`, `JobAc
Diffed against: <https://developer.servicem8.com/llms.txt>
-- [ ] `Materials (GET /api_1.0/material.json)` — resolve JobMaterial.material_uuid and Staff.labour_material_uuid to inventory records, labour rates, costs, and stock levels (high)
-- [ ] `Tax Rates (GET /api_1.0/taxrate.json)` — resolve tax_rate_uuid on job materials and clients to named tax rates (high)
+- [x] `Materials (GET /api_1.0/material.json)` — resolve JobMaterial.material_uuid and Staff.labour_material_uuid to inventory records, labour rates, costs, and stock levels (high)
+- [x] `Tax Rates (GET /api_1.0/taxrate.json)` — resolve tax_rate_uuid on job materials and clients to named tax rates (high)
- [ ] `Job Queues (GET /api_1.0/queue.json)` — resolve Job.queue_uuid to queue names for backlog and dispatch analysis (high)
- [ ] `Badges (GET /api_1.0/badge.json)` — resolve badge UUIDs on jobs and clients to meaningful business classifications (high)
- [ ] `Job Material Bundles (GET /api_1.0/jobmaterialbundle.json)` — resolve JobMaterial.job_material_bundle_uuid and analyze the bundled work sold on each job (high)
-- [ ] `Staff Time Events (GET /api_1.0/stafftimeevent.json)` — measure working hours and breaks beyond time recorded against individual jobs (high)
-- [ ] `Feedback (GET /api_1.0/feedback.json)` — measure customer satisfaction and connect feedback to completed jobs (high)
+- [x] `Staff Time Events (GET /api_1.0/stafftimeevent.json)` — measure working hours and breaks beyond time recorded against individual jobs (high)
+- [x] `Feedback (GET /api_1.0/feedback.json)` — measure customer satisfaction and connect feedback to completed jobs (high)
- [ ] `Job Allocations (GET /api_1.0/joballocation.json)` — compare scheduled work, staff assignments, and actual job activity (medium)
- [ ] `Forms and Form Responses (GET /api_1.0/form.json; GET /api_1.0/formresponse.json)` — analyze inspection results and completed forms by job, staff member, and asset (medium)
- [ ] `Job Contacts (GET /api_1.0/jobcontact.json)` — connect job and billing contacts to jobs instead of relying on company contacts alone (medium)
diff --git a/products/warehouse_sources/sources/servicem8/canonical_descriptions.py b/products/warehouse_sources/sources/servicem8/canonical_descriptions.py
index 98d3332ba5e3..24bd689e818d 100644
--- a/products/warehouse_sources/sources/servicem8/canonical_descriptions.py
+++ b/products/warehouse_sources/sources/servicem8/canonical_descriptions.py
@@ -147,4 +147,50 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
is_favourite="Whether the attachment is marked as a favourite.",
),
},
+ "Material": {
+ "description": "An inventory item, product, or labour rate that can be added to jobs.",
+ "docs_url": "https://developer.servicem8.com/reference/listmaterials",
+ "columns": _columns(
+ name="Name of the material, product, or labour rate.",
+ item_number="Item code for the material, unique within the account.",
+ item_description="Description of the material.",
+ price="Selling price; includes tax when price_includes_taxes is 1.",
+ cost="Purchase cost; includes tax when price_includes_taxes is 1.",
+ price_includes_taxes="Whether price and cost include tax (1) or exclude it (0).",
+ tax_rate_uuid="UUID of the tax rate applied to the material.",
+ quantity_in_stock="Current quantity of the material in stock.",
+ item_is_inventoried="Whether stock levels are tracked for the material.",
+ barcode="Barcode (UPC, EAN, or other format) of the material.",
+ ),
+ },
+ "TaxRate": {
+ "description": "A named tax rate (for example GST or VAT) applied to materials and invoices.",
+ "docs_url": "https://developer.servicem8.com/reference/listtaxrates",
+ "columns": _columns(
+ name="Name of the tax rate, such as GST or VAT.",
+ amount="Tax rate as a percentage, e.g. 10 for 10%.",
+ is_default_tax_rate="Whether this is the account's default tax rate.",
+ ),
+ },
+ "StaffTimeEvent": {
+ "description": "A staff clock-on, clock-off, or lunch-break event, separate from job check-ins.",
+ "docs_url": "https://developer.servicem8.com/reference/liststafftimeevents",
+ "columns": _columns(
+ staff_uuid="UUID of the staff member the event belongs to.",
+ timestamp="Event time in the account timezone (YYYY-MM-DD HH:MM:SS).",
+ event_name="Action recorded: CLOCK_ON, CLOCK_OFF, LUNCH_START, or LUNCH_END.",
+ source="Origin of the recorded event.",
+ ),
+ },
+ "Feedback": {
+ "description": "A customer feedback rating and comment, usually about a job.",
+ "docs_url": "https://developer.servicem8.com/reference/listfeedback",
+ "columns": _columns(
+ timestamp="Date and time the feedback was submitted.",
+ related_object="Type of object the feedback is about, usually job or vendor.",
+ related_object_uuid="UUID of the object the feedback is about.",
+ rating="Rating from 1 to 5; higher is more positive.",
+ comment="Text comment left with the feedback.",
+ ),
+ },
}
diff --git a/products/warehouse_sources/sources/servicem8/settings.py b/products/warehouse_sources/sources/servicem8/settings.py
index 76253dfe6010..557baa236915 100644
--- a/products/warehouse_sources/sources/servicem8/settings.py
+++ b/products/warehouse_sources/sources/servicem8/settings.py
@@ -20,6 +20,10 @@ ENDPOINT_PATHS: dict[str, str] = {
"JobPayment": "jobpayment",
"Note": "note",
"Attachment": "attachment",
+ "Material": "material",
+ "TaxRate": "taxrate",
+ "StaffTimeEvent": "stafftimeevent",
+ "Feedback": "feedback",
}
ENDPOINTS: tuple[str, ...] = tuple(ENDPOINT_PATHS)
diff --git a/products/warehouse_sources/sources/servicem8/tests/test_servicem8.py b/products/warehouse_sources/sources/servicem8/tests/test_servicem8.py
index e22483913fe1..71eab0c8aa3b 100644
--- a/products/warehouse_sources/sources/servicem8/tests/test_servicem8.py
+++ b/products/warehouse_sources/sources/servicem8/tests/test_servicem8.py
@@ -1,6 +1,7 @@
from datetime import UTC, date, datetime
from typing import Any
+import pytest
from unittest.mock import MagicMock
from requests import Request
@@ -77,6 +78,21 @@ class TestServiceM8SourceResumeBehavior:
assert result.params("cursor") == ["cursor-resumed"]
+ @pytest.mark.parametrize(
+ "endpoint,path",
+ [
+ ("Job", "/api_1.0/job.json"),
+ ("Material", "/api_1.0/material.json"),
+ ("TaxRate", "/api_1.0/taxrate.json"),
+ ("StaffTimeEvent", "/api_1.0/stafftimeevent.json"),
+ ("Feedback", "/api_1.0/feedback.json"),
+ ],
+ )
+ def test_requests_the_vendor_object_path(self, endpoint: str, path: str) -> None:
+ result = self._drive(endpoint, [_make_http_response([{"uuid": "a"}])])
+
+ assert result.paths == [path]
+
def test_starts_from_the_first_page_when_there_is_no_saved_state(self) -> None:
result = self._drive("Job", [_make_http_response([{"uuid": "a"}])])