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 devin ai automations table (#113216)

Tom Owers481449e7794e
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 9274084a70b8..057adbc8b3f4 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
@@ -2470,7 +2470,7 @@ Note: `Groups` covers all three group operations. `/v1/mgmt/group/all` returns e
## DevinAI — **thin**
-Today (9): `consumption_daily`, `consumption_daily_users`, `knowledge_notes`, `members`, `playbooks`, `secrets`, `session_insights`, `session_messages`, `sessions`
+Today (10): `automations`, `consumption_daily`, `consumption_daily_users`, `knowledge_notes`, `members`, `playbooks`, `secrets`, `session_insights`, `session_messages`, `sessions`
Diffed against: <https://docs.devin.ai/llms.txt>
@@ -2486,6 +2486,7 @@ Diffed against: <https://docs.devin.ai/llms.txt>
- [x] `/v3/organizations` — organization lookup for enterprises with multiple orgs under one key (medium) — does not exist at org scope. The listing is `/v3/enterprise/organizations` and needs `ViewOrganizations` at enterprise level, which this source's org-scoped service user does not hold.
- [x] `/v3/organizations/{org_id}/guardrail-violations` — policy violations raised during sessions — compliance reporting (medium) — does not exist at org scope. The listing is `/v3beta1/enterprise/organizations/{org_id}/guardrail-violations` (beta) and needs both `ManageEnterpriseSettings` and `ViewAccountSessions` at enterprise level. It is otherwise a good fit — the standard `items`/`end_cursor` envelope, a `violation_id` key, and server-side `time_after`/`time_before` — so it becomes buildable if this source ever stores an enterprise service user.
- [ ] `/v3/organizations/{org_id}/knowledge/folders` — folder lookup that gives the synced knowledge notes their hierarchy (low)
+- [x] `/v3/organizations/{org_id}/automations` — event-driven workflows that start Devin sessions, replacing the deprecated schedules endpoints (medium) — added as `automations`. Full refresh only: the listing returns newest first and has no server-side time filter.
Note: docs.devin.ai/llms.txt enumerates every v1/v2/v3 API reference page; v3 alone spans sessions, consumption, metrics, users, repositories, pr-reviews, audit-logs, code-scans, guardrails and more, so 9 synced tables (one of which, secrets, is plumbing) is still a small fraction.
That page count overstates what this source can reach, though: checked against the v3 OpenAPI spec (<https://docs.devin.ai/v3-openapi.json>), a large share of v3 lives under `/v3/enterprise/` or `/v3beta1/enterprise/` and needs an enterprise-level service user, while this source stores an org-level one.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/canonical_descriptions.py
index c027524cba20..645f42f215b6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/canonical_descriptions.py
@@ -128,6 +128,25 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"acus_by_product": "The day's ACUs split by product (devin, cascade, terminal, review).",
},
},
+ "automations": {
+ "description": "A Devin automation: a workflow that starts or messages Devin sessions when a trigger fires, such as a Slack message, a GitHub or Linear event, a schedule, or an incoming webhook.",
+ "docs_url": "https://docs.devin.ai/api-reference/v3/automations/organizations-automations",
+ "columns": {
+ "automation_id": "Unique identifier for the automation.",
+ "name": "Automation name.",
+ "enabled": "Whether the automation is active.",
+ "triggers": "Events that fire the automation, each with an event_type and optional conditions.",
+ "actions": "What the automation does when it fires, such as start_session or message_session.",
+ "metadata": "User-defined key-value labels on the automation.",
+ "template_id": "Identifier of the template the automation was created from, if any.",
+ "created_by": "User or service user that created the automation (type, id, name).",
+ "last_edited_by": "User or service user that last edited the automation.",
+ "created_at": "Unix timestamp (seconds) when the automation was created.",
+ "updated_at": "Unix timestamp (seconds) when the automation was last updated.",
+ "last_invocation": "When the automation last fired (fired_at) and its outcome (succeeded, failed, skipped).",
+ "next_run_at": "Unix timestamp (seconds) when the next schedule trigger fires. Null when the automation has no schedule.",
+ },
+ },
"secrets": {
"description": "Metadata for an org-level secret available to Devin sessions. Secret values are never returned by the API and are not synced.",
"docs_url": "https://docs.devin.ai/api-reference/v3/secrets/organizations-secrets",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/settings.py
index 985cf7ea57d6..5939bfab37dd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/settings.py
@@ -96,6 +96,13 @@ DEVIN_AI_ENDPOINTS: dict[str, DevinAIEndpointConfig] = {
path="/v3/organizations/{org_id}/knowledge/notes",
primary_keys=["note_id"],
),
+ # Event-driven workflows that start Devin sessions; they replace the deprecated schedules endpoints.
+ # The listing has no server-side time filter, so full refresh only.
+ "automations": DevinAIEndpointConfig(
+ name="automations",
+ path="/v3/organizations/{org_id}/automations",
+ primary_keys=["automation_id"],
+ ),
# Org members, carrying user_id + email so the opaque user_id on sessions resolves to a person.
# Backed by the v3beta1 org-scoped users listing (needs the org-level `ViewOrgMembership`
# permission): the stable alternatives require credentials this source doesn't store (the v2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/source.py
index 9be6403db355..b8e9399e0d94 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/source.py
@@ -62,6 +62,7 @@ Create a service user API key (prefixed `cog_`) in your [Devin organization sett
- `ViewOrgSessions` — Sessions, session insights and session messages
- `ViewOrgConsumption` — Daily ACU consumption, per org and per user
- `ManageAccountKnowledge` — Playbooks and Knowledge notes
+- `ViewOrgAutomations` — Automations
- `ViewOrgMembership` — Members, and the per-user consumption that fans out from them
- `ManageOrgSecrets` — Secrets (metadata only; values are never synced)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/tests/test_devin_ai.py b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/tests/test_devin_ai.py
index 138fce29a46a..8d3314e6a2e2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/tests/test_devin_ai.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/devin_ai/tests/test_devin_ai.py
@@ -108,6 +108,7 @@ class TestEndpointPath:
("playbooks", "/v3/organizations/org-abc/playbooks"),
("knowledge_notes", "/v3/organizations/org-abc/knowledge/notes"),
("secrets", "/v3/organizations/org-abc/secrets"),
+ ("automations", "/v3/organizations/org-abc/automations"),
("session_insights", "/v3/organizations/org-abc/sessions/insights"),
("consumption_daily", "/v3/organizations/org-abc/consumption/daily"),
# Members must stay on the org-scoped users listing: the v2 members endpoint only accepts
@@ -269,7 +270,7 @@ class TestGetStatusCode:
class TestDevinAISource:
- @parameterized.expand(["sessions", "session_insights", "playbooks", "knowledge_notes", "secrets"])
+ @parameterized.expand(["sessions", "session_insights", "playbooks", "knowledge_notes", "secrets", "automations"])
@mock.patch(CLIENT_SESSION_PATCH)
def test_source_response_uses_endpoint_primary_keys_and_stable_partition(self, endpoint: str, MockSession) -> None:
response = _source(endpoint, _make_manager())