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.

chore(devex): mount product root routes with include() (#102167)

Julian Bez0372b9d28069
diff --git a/.agents/skills/adding-inbound-webhooks/SKILL.md b/.agents/skills/adding-inbound-webhooks/SKILL.md
index a26144cb3590..6cccf27b515b 100644
--- a/.agents/skills/adding-inbound-webhooks/SKILL.md
+++ b/.agents/skills/adding-inbound-webhooks/SKILL.md
@@ -82,7 +82,7 @@ Three exist. Configure one; do not write a fourth without reading [the Schemes s
Then:
1. Add the module path to `_INCARNATION_MODULES` in `posthog/ingress/providers.py`, or the registry never sees its specs or core consumers.
-2. Wire the URL with `build_webhook_view()` where the App registration lives. The owner of the third-party App owns the route: a product that registered the App declares `urlpatterns` in its own `products/<product>/backend/routes.py`, for example `opt_slash_path("webhooks/<product>/<provider>", build_webhook_view(build_<provider>_provider()))`. The path must start with `webhooks/<product>/` or `api/<product>/`, or the URL conf fails to load. Only an App several products consume stays in `posthog/urls.py`, which today is the customer-facing GitHub App alone. See [docs/internal/url-routing.md](../../../docs/internal/url-routing.md).
+2. Wire the URL with `build_webhook_view()` where the App registration lives. The owner of the third-party App owns the route: a product that registered the App declares `webhook_urlpatterns` in its own `products/<product>/backend/routes.py`, for example `opt_slash_path("<provider>", build_webhook_view(build_<provider>_provider()))`. Core mounts that list at `webhooks/<product>/`, so the route is relative to it. Only an App several products consume stays in `posthog/urls.py`, which today is the customer-facing GitHub App alone. See [docs/internal/url-routing.md](../../../docs/internal/url-routing.md).
3. Write `posthog/ingress/<provider>/README.md` with the fixed sections, in this order: headers, signature scheme, delivery id and event type, apps and secrets, quirks, consumers. `posthog/ingress/test/test_provider_readme_sections.py` fails on a provider folder without one, and on a README with different or reordered headings.
4. Add the provider's signature header name to the `$HEADER` regex in `.semgrep/rules/devex/inbound-webhooks-go-through-ingress.yaml`, plus a fixture case in the `.py` beside it. The header names are spelled out rather than matched generically because a generic header pattern makes semgrep time out on a large module, which drops that file from the scan without failing it.
5. Do not add the endpoint to `paths.exclude` in the same rule. Every verifier that predated ingress is migrated, so the rule has no grandfathered paths left.
diff --git a/docs/internal/url-routing.md b/docs/internal/url-routing.md
index 8b8e08a71cdd..9ba81b81b466 100644
--- a/docs/internal/url-routing.md
+++ b/docs/internal/url-routing.md
@@ -23,16 +23,24 @@ These conditions control registration, not only view behavior.
## Product root routes
-A product declares its root paths in `products/<product>/backend/routes.py`, as a `urlpatterns` list beside `register_routes`.
-`posthog/product_urls.py` collects every product's list, and `posthog/urls.py` splices it into one slot: after all core routes, and before the `^api.+` fallback and the frontend catch-all.
+A product declares its root paths in `products/<product>/backend/routes.py`, beside `register_routes`, in up to two lists:
+
+- `api_urlpatterns`, mounted at `api/<product>/`
+- `webhook_urlpatterns`, mounted at `webhooks/<product>/`
+
+`<product>` is the product directory name, underscores included.
+Routes in each list are relative to the mount, so `path("vapi_webhook/", ...)` in `products/user_interviews/` serves `/api/user_interviews/vapi_webhook/`.
+
+`posthog/product_urls.py` turns each list into a `path(<prefix>, include(<list>))` mount, and `posthog/urls.py` splices every product's mounts into one slot: after every core `api/` route, and before the `^api.+` fallback and the frontend catch-all.
Precedence stays one list to read, and a product that adds a path does not touch core.
-Each pattern must start with `api/<product>/` or `webhooks/<product>/`, where `<product>` is the product directory name.
-A pattern outside those prefixes raises `ProductRouteError` when the URL conf loads.
-The check is fail-closed because a product path in core's namespace can shadow a core route, and the winner would then depend on app iteration order.
+The prefix holds by construction: a route inside the mount cannot address anything outside it, so a product cannot shadow a core route outside its own prefix.
+Inside its prefix, a core route listed above the slot still wins, which is how `api/user_interviews/share/<token>/start_call/` stays in core.
+`include()` receives the list, not the module, so Django sets no application namespace and `reverse("<name>")` keeps working unchanged.
+A routes module that declares any other url patterns list raises `ImproperlyConfigured` when the URL conf loads, rather than having its routes dropped silently. That covers the old flat `urlpatterns` and a near miss such as `webhooks_urlpatterns`, and the error names both valid lists.
`register_routes(routers)` stays the way to add DRF routes.
-Use `urlpatterns` only for a plain Django path that no router can carry, such as an inbound webhook endpoint.
+Use these two lists only for a plain Django path that no router can carry, such as an inbound webhook endpoint.
### Who owns a webhook route
diff --git a/posthog/api/test/test_product_urls.py b/posthog/api/test/test_product_urls.py
index ef61387f4f7e..cc9dfbde6dea 100644
--- a/posthog/api/test/test_product_urls.py
+++ b/posthog/api/test/test_product_urls.py
@@ -1,14 +1,13 @@
from types import ModuleType
+from django.core.exceptions import ImproperlyConfigured
from django.http import HttpRequest, HttpResponse
from django.test import SimpleTestCase
-from django.urls import path, re_path, resolve, reverse
+from django.urls import path, resolve, reverse
from parameterized import parameterized
-import posthog.urls
-from posthog.api import api_not_found
-from posthog.product_urls import ProductRootRoutes, ProductRouteError
+from posthog.product_urls import ProductRootRoutes
from posthog.utils import opt_slash_path
@@ -16,78 +15,54 @@ def _view(request: HttpRequest) -> HttpResponse:
return HttpResponse()
-def _routes_module(product: str, *routes: str) -> ModuleType:
- module = ModuleType(f"products.{product}.backend.routes")
- module.urlpatterns = [path(route, _view) for route in routes] # type: ignore[attr-defined]
- return module
+def _routes_module() -> ModuleType:
+ return ModuleType("products.stamphog.backend.routes")
class TestProductRootRoutes(SimpleTestCase):
- def test_collects_the_patterns_a_product_declares(self) -> None:
- module = _routes_module("stamphog", "webhooks/stamphog/github", "api/stamphog/thing")
+ def test_mounts_each_declared_list_under_the_prefix_reserved_for_the_product(self) -> None:
+ module = _routes_module()
+ module.api_urlpatterns = [path("thing", _view)] # type: ignore[attr-defined]
+ module.webhook_urlpatterns = [opt_slash_path("github", _view)] # type: ignore[attr-defined]
- collected = ProductRootRoutes.from_module(module)
+ mounts = ProductRootRoutes.from_module(module)
- assert [str(pattern.pattern) for pattern in collected] == [
- "webhooks/stamphog/github",
- "api/stamphog/thing",
- ]
+ assert [str(mount.pattern) for mount in mounts] == ["api/stamphog/", "webhooks/stamphog/"]
- def test_a_module_without_urlpatterns_contributes_nothing(self) -> None:
- assert ProductRootRoutes.from_module(ModuleType("products.stamphog.backend.routes")) == []
+ def test_a_module_that_declares_no_list_contributes_nothing(self) -> None:
+ assert ProductRootRoutes.from_module(_routes_module()) == []
- @parameterized.expand(
- [
- ("core namespace", "webhooks/github"),
- ("another product", "api/legal_documents/pandadoc"),
- ("prefix without the separator", "webhooks/stamphogus/github"),
- ("unreserved namespace", "internal/stamphog/thing"),
- ]
- )
- def test_rejects_a_route_outside_the_products_own_prefixes(self, _name: str, route: str) -> None:
- module = _routes_module("stamphog", route)
+ @parameterized.expand([("urlpatterns",), ("webhooks_urlpatterns",), ("api_url_patterns",)])
+ def test_a_module_that_declares_an_unmounted_list_fails_the_url_conf(self, name: str) -> None:
+ module = _routes_module()
+ setattr(module, name, [path("thing", _view)])
- with self.assertRaises(ProductRouteError) as caught:
+ with self.assertRaises(ImproperlyConfigured) as caught:
ProductRootRoutes.from_module(module)
- assert str(caught.exception) == (
- f"Product 'stamphog' declares root URL pattern {route!r}, which must start with "
- "'api/stamphog/' or 'webhooks/stamphog/'"
- )
+ assert name in str(caught.exception)
+ assert "'api_urlpatterns'" in str(caught.exception)
+
+class TestProductRootRoutesInTheUrlConf(SimpleTestCase):
@parameterized.expand(
[
- ("bare regex", "webhooks/stamphog/github"),
- ("regex ending in a group", "webhooks/stamphog/github/?"),
+ ("a path a product declares", "/api/user_interviews/vapi_webhook/", "user_interviews_vapi_webhook"),
+ ("a path without a trailing slash", "/api/legal_documents/pandadoc", "legal_document_pandadoc_webhook"),
+ ("a list a product includes", "/api/customer_analytics/external/account", "external-account"),
]
)
- def test_rejects_an_unanchored_regex_route(self, _name: str, regex: str) -> None:
- module = ModuleType("products.stamphog.backend.routes")
- module.urlpatterns = [re_path(regex, _view)] # type: ignore[attr-defined]
-
- with self.assertRaises(ProductRouteError) as caught:
- ProductRootRoutes.from_module(module)
-
- assert str(caught.exception) == (
- f"Product 'stamphog' declares root URL pattern {regex!r} as an unanchored regex, "
- "which matches anywhere in the path. Start it with '^'"
- )
+ def test_a_mounted_route_keeps_its_url_and_its_global_name(self, _name: str, url: str, route_name: str) -> None:
+ assert resolve(url).url_name == route_name
+ assert reverse(route_name) == url
- def test_accepts_the_anchored_regex_opt_slash_path_builds(self) -> None:
- module = ModuleType("products.stamphog.backend.routes")
- module.urlpatterns = [opt_slash_path("webhooks/stamphog/github", _view)] # type: ignore[attr-defined]
-
- assert len(ProductRootRoutes.from_module(module)) == 1
-
-
-class TestProductRootRouteSlot(SimpleTestCase):
- def test_product_routes_sit_after_core_routes_and_before_the_api_fallback(self) -> None:
- names = [getattr(pattern, "name", None) for pattern in posthog.urls.urlpatterns]
- routes = [str(pattern.pattern) for pattern in posthog.urls.urlpatterns]
-
- assert names.index("schema") < names.index("user_interviews_vapi_webhook")
- assert names.index("user_interviews_vapi_webhook") < routes.index("^api.+")
-
- def test_the_api_fallback_does_not_shadow_a_moved_product_route(self) -> None:
- assert reverse("user_interviews_vapi_webhook") == "/api/user_interviews/vapi_webhook/"
- assert resolve("/api/user_interviews/vapi_webhook/").func is not api_not_found
+ @parameterized.expand(
+ [
+ ("stamphog bare", "/webhooks/stamphog/github", "github_stamphog_webhook"),
+ ("stamphog trailing slash", "/webhooks/stamphog/github/", "github_stamphog_webhook"),
+ ("workflows bare", "/webhooks/workflows/ses-events", "sns_default_webhook"),
+ ("workflows trailing slash", "/webhooks/workflows/ses-events/", "sns_default_webhook"),
+ ]
+ )
+ def test_an_opt_slash_route_matches_relative_to_its_mount(self, _name: str, url: str, view_name: str) -> None:
+ assert resolve(url).func.__name__ == view_name
diff --git a/posthog/ingress/README.md b/posthog/ingress/README.md
index fada242c45bc..01d22f6ab26e 100644
--- a/posthog/ingress/README.md
+++ b/posthog/ingress/README.md
@@ -249,14 +249,16 @@ Add a `<provider>/` subpackage with a `provider.py` holding three things (see `g
Add the module to `_INCARNATION_MODULES` in `posthog/ingress/providers.py`, so the registry finds its specs and any core consumers.
Then mount the URL where the App registration lives.
-A product that registered the App declares the path in its own `products/<product>/backend/routes.py`, under a `webhooks/<product>/` prefix:
+A product that registered the App declares the path in its own `products/<product>/backend/routes.py`, in a `webhook_urlpatterns` list that core mounts at `webhooks/<product>/`:
```python
-urlpatterns: list[URLPattern] = [
- opt_slash_path("webhooks/stamphog/github", build_webhook_view(build_github_provider("stamphog"))),
+webhook_urlpatterns: list[URLPattern] = [
+ opt_slash_path("github", build_webhook_view(build_github_provider("stamphog"))),
]
```
+The route is relative to the mount, so this one serves `/webhooks/stamphog/github`.
+
An App several products consume has no single owner, so it stays in `posthog/urls.py`.
The customer-facing GitHub App is the only one today.
[docs/internal/url-routing.md](../../docs/internal/url-routing.md) has the slot and the prefix rule.
diff --git a/posthog/product_urls.py b/posthog/product_urls.py
index 2a6806fc5071..312d32fcda9c 100644
--- a/posthog/product_urls.py
+++ b/posthog/product_urls.py
@@ -1,85 +1,72 @@
-"""Collection of the root URL patterns that products declare for themselves.
+"""The root URL mounts that products declare for themselves.
`register_routes(routers)` in `products/<product>/backend/routes.py` covers DRF routers only.
-A plain Django path has no router to register onto, so a product declares one in the same module
-as a `urlpatterns` list, and `posthog/urls.py` mounts every product's list in one slot.
+A plain Django path has no router to register onto, so a product declares it in the same module
+as an `api_urlpatterns` or `webhook_urlpatterns` list, with routes relative to the mount.
+`posthog/urls.py` mounts both lists in one slot.
"""
-from collections.abc import Iterable
from types import ModuleType
-from django.urls import URLPattern, URLResolver
-from django.urls.resolvers import RegexPattern
+from django.core.exceptions import ImproperlyConfigured
+from django.urls import URLResolver, include, path
from posthog.products import load_product_modules
-class ProductRouteError(Exception):
- """A product root URL pattern outside the prefixes reserved for that product."""
-
-
class ProductRootRoutes:
- """The root patterns products declare, and the prefix rule they must satisfy."""
+ """The prefixes reserved per product, and the lists mounted under them."""
# A product route in core's namespace can shadow a core route, and which one wins would then
- # depend on app iteration order. Reserving a prefix per product removes both.
- PREFIX_TEMPLATES: tuple[str, ...] = ("api/{product}/", "webhooks/{product}/")
+ # depend on app iteration order. A mount per product removes both, because a route declared
+ # inside the mount cannot address anything outside it.
+ MOUNTS: tuple[tuple[str, str], ...] = (
+ ("api_urlpatterns", "api/{product}/"),
+ ("webhook_urlpatterns", "webhooks/{product}/"),
+ )
@staticmethod
def _product_name(routes_module_name: str) -> str:
"""`products.stamphog.backend.routes` -> `stamphog`."""
return routes_module_name.split(".")[1]
- @staticmethod
- def _route_of(pattern: URLPattern | URLResolver) -> str:
- """The declared route of a pattern, without the regex anchor.
-
- `path()` carries the route string. `re_path()`, which `opt_slash_path()` builds on,
- carries the regex, and that regex starts with `^` whenever it is anchored.
- """
- return str(pattern.pattern).removeprefix("^")
-
- @staticmethod
- def _is_unanchored_regex(pattern: URLPattern | URLResolver) -> bool:
- """Whether Django will look for this pattern anywhere in the path.
-
- A `RegexPattern` that does not end in `$` is matched with `re.search`, so a regex without
- a leading `^` also matches a path that merely contains it. Its text would still start
- with the product's prefix, which is why the prefix check alone cannot catch this.
- `path()` builds a `RoutePattern`, which Django anchors itself.
- """
- return isinstance(pattern.pattern, RegexPattern) and not str(pattern.pattern).startswith("^")
-
@classmethod
- def from_module(cls, routes_module: ModuleType) -> list[URLPattern | URLResolver]:
- """The root patterns one product's routes module declares, checked against the rule.
+ def from_module(cls, routes_module: ModuleType) -> list[URLResolver]:
+ """The mounts one product's routes module asks for.
+
+ `include()` gets the list, not the module, so Django sets no application namespace and
+ `reverse("<name>")` keeps working unchanged.
- The check raises at URL conf load rather than logging, so a bad prefix fails every
- process start and every test instead of silently shadowing a core route in production.
+ A module that declares any other url patterns name raises instead of being skipped: the old
+ flat `urlpatterns`, or a near miss such as `webhooks_urlpatterns`. A skip would drop its
+ routes and only show up as a 404 in production.
"""
- declared: Iterable[URLPattern | URLResolver] = getattr(routes_module, "urlpatterns", ())
- patterns = list(declared)
product = cls._product_name(routes_module.__name__)
- allowed = tuple(template.format(product=product) for template in cls.PREFIX_TEMPLATES)
-
- for pattern in patterns:
- if cls._is_unanchored_regex(pattern):
- raise ProductRouteError(
- f"Product {product!r} declares root URL pattern {str(pattern.pattern)!r} as an "
- f"unanchored regex, which matches anywhere in the path. Start it with '^'"
- )
- route = cls._route_of(pattern)
- if not route.startswith(allowed):
- allowed_list = " or ".join(repr(prefix) for prefix in allowed)
- raise ProductRouteError(
- f"Product {product!r} declares root URL pattern {route!r}, which must start with {allowed_list}"
- )
- return patterns
+ mounted = {attribute for attribute, _ in cls.MOUNTS}
+ unmounted = sorted(
+ name
+ for name in vars(routes_module)
+ if name.replace("_", "").lower().endswith("urlpatterns") and name not in mounted
+ )
+ if unmounted:
+ raise ImproperlyConfigured(
+ f"Product {product!r} declares {', '.join(unmounted)} in its routes module, which core "
+ f"does not mount. Use 'api_urlpatterns' for routes under 'api/{product}/' or "
+ f"'webhook_urlpatterns' for routes under 'webhooks/{product}/', with every route "
+ f"relative to that prefix"
+ )
+
+ mounts = []
+ for attribute, prefix_template in cls.MOUNTS:
+ declared = getattr(routes_module, attribute, None)
+ if declared:
+ mounts.append(path(prefix_template.format(product=product), include(declared)))
+ return mounts
@classmethod
- def collect(cls) -> list[URLPattern | URLResolver]:
- """Every product's root patterns, in one list for `posthog/urls.py` to splice in."""
- collected: list[URLPattern | URLResolver] = []
+ def collect(cls) -> list[URLResolver]:
+ """Every product's mounts, for the one slot in `posthog/urls.py`."""
+ collected: list[URLResolver] = []
for routes_module in load_product_modules("routes"):
collected.extend(cls.from_module(routes_module))
return collected
diff --git a/posthog/urls.py b/posthog/urls.py
index 275206e0fb9c..afc703dd7d45 100644
--- a/posthog/urls.py
+++ b/posthog/urls.py
@@ -153,10 +153,12 @@ urlpatterns = [
name="user_interviews_start_call",
),
path("api/sdk_health/", sdk_health),
+ # Conversations serves its widget and channel API from backend/api/, which its routes module
+ # may not import (import-linter contract "routes must only import presentation"), so the mount
+ # stays here until those views move into presentation/.
path("api/conversations/", include("products.conversations.backend.api.urls")),
# Routes the security hub calls from outside the cluster (auth: scoped service JWT)
path("api/security/", include(security_hub_urlpatterns)),
- path("api/customer_analytics/", include("products.customer_analytics.backend.presentation.views.urls")),
path(
"api/projects/<int:parent_lookup_team_id>/mcp_analytics/",
include("products.mcp_analytics.backend.presentation.urls"),
@@ -296,8 +298,8 @@ urlpatterns = [
HogliClientMetadataView.as_view(),
name="hogli-client-metadata",
),
- # The one slot for root routes products declare themselves, after every core route and before
- # the API fallback and the frontend catch-all. See docs/internal/url-routing.md.
+ # The one slot for root routes products declare themselves, after every core api/ route and
+ # before the API fallback and the frontend catch-all. See docs/internal/url-routing.md.
*ProductRootRoutes.collect(),
re_path(r"^api.+", api_not_found),
path("authorize_and_redirect/", login_required(authorize_and_redirect)),
diff --git a/products/README.md b/products/README.md
index bb794d02f1c6..746cc4f2c4c4 100644
--- a/products/README.md
+++ b/products/README.md
@@ -24,7 +24,7 @@ products/
apps.py
models.py
logic.py # business logic
- routes.py # API routes: register_routes(routers) + urlpatterns, auto-discovered from INSTALLED_APPS
+ routes.py # API routes: register_routes(routers) + api_urlpatterns/webhook_urlpatterns, auto-discovered
migrations/
facade/ # cross-product Python interface
__init__.py
@@ -199,7 +199,7 @@ bin/hogli product:lint --regenerate-baseline
- Modify `posthog/settings/web.py` and add your new product under `PRODUCTS_APPS`.
- Modify `tach.toml` and add a new block for your product. We use `tach` to track cross-dependencies between python apps.
- Add your API routes in `backend/routes.py` with a `register_routes(routers)` function (e.g. `routers.projects.register(r"my_thing", MyThingViewSet, "project_my_thing", ["team_id"])`). It is auto-discovered — once the product is in `PRODUCTS_APPS`, `posthog/api/__init__.py` finds and calls `register_routes(routers)` with no edit to core. See `posthog/api/routing.py:RouterRegistry` for the available router handles (`projects`/`environments`/`organizations`/`root`).
- - For a plain Django path no router can carry, such as an inbound webhook endpoint, add a `urlpatterns` list to the same `routes.py`. Core mounts every product's list in one slot in `posthog/urls.py`. Each pattern must start with `api/<product>/` or `webhooks/<product>/`, or the URL conf fails to load. See [docs/internal/url-routing.md](../docs/internal/url-routing.md).
+ - For a plain Django path no router can carry, such as an inbound webhook endpoint, add an `api_urlpatterns` or `webhook_urlpatterns` list to the same `routes.py`. Core mounts them at `api/<product>/` and `webhooks/<product>/` in one slot in `posthog/urls.py`, so the routes in each list are relative to that mount. See [docs/internal/url-routing.md](../docs/internal/url-routing.md).
- NOTE: we will automate some of these steps in the future, but for now, please do them manually.
## Adding or moving backend models and migrations
diff --git a/products/customer_analytics/backend/routes.py b/products/customer_analytics/backend/routes.py
index 7a078c01e8d5..c0bef85b6f95 100644
--- a/products/customer_analytics/backend/routes.py
+++ b/products/customer_analytics/backend/routes.py
@@ -1,5 +1,6 @@
from posthog.api.routing import RouterRegistry
+from products.customer_analytics.backend.presentation.views import urls as external_api_urls
from products.customer_analytics.backend.presentation.views.accounts_table_query import AccountsTableQueryViewSet
from products.customer_analytics.backend.presentation.views.announcements import AnnouncementViewSet
from products.customer_analytics.backend.presentation.views.customer_tasks import CustomerTaskViewSet
@@ -26,6 +27,8 @@ from products.customer_analytics.backend.presentation.views.views import (
)
from products.customer_analytics.backend.presentation.views.workflow_customer_tasks import WorkflowCustomerTaskViewSet
+api_urlpatterns = external_api_urls.urlpatterns
+
def register_routes(routers: RouterRegistry) -> None:
routers.projects.register(
diff --git a/products/legal_documents/backend/routes.py b/products/legal_documents/backend/routes.py
index e78bc50dbfb6..5402dbfe9d4c 100644
--- a/products/legal_documents/backend/routes.py
+++ b/products/legal_documents/backend/routes.py
@@ -5,9 +5,9 @@ from posthog.api.routing import RouterRegistry
from products.legal_documents.backend.presentation.views import LegalDocumentViewSet
from products.legal_documents.backend.presentation.webhook import legal_document_pandadoc_webhook
-urlpatterns: list[URLPattern] = [
+api_urlpatterns: list[URLPattern] = [
path(
- "api/legal_documents/pandadoc",
+ "pandadoc",
legal_document_pandadoc_webhook,
name="legal_document_pandadoc_webhook",
),
diff --git a/products/stamphog/backend/routes.py b/products/stamphog/backend/routes.py
index 4ff44dda994f..9b9ea038762b 100644
--- a/products/stamphog/backend/routes.py
+++ b/products/stamphog/backend/routes.py
@@ -11,8 +11,8 @@ from .presentation.views import DigestRunViewSet, PullRequestViewSet, ReviewRunV
# Stamphog runs on its own GitHub App, with its own signing secret and its own consumers, so it
# gets its own view rather than sharing the customer-facing App's endpoint.
-urlpatterns: list[URLPattern] = [
- opt_slash_path("webhooks/stamphog/github", build_webhook_view(build_github_provider("stamphog"))),
+webhook_urlpatterns: list[URLPattern] = [
+ opt_slash_path("github", build_webhook_view(build_github_provider("stamphog"))),
]
diff --git a/products/user_interviews/backend/routes.py b/products/user_interviews/backend/routes.py
index 3e038c78cebb..2382b9e687be 100644
--- a/products/user_interviews/backend/routes.py
+++ b/products/user_interviews/backend/routes.py
@@ -9,9 +9,9 @@ from products.user_interviews.backend.presentation.views import (
)
from products.user_interviews.backend.presentation.webhooks import vapi_webhook
-urlpatterns: list[URLPattern] = [
+api_urlpatterns: list[URLPattern] = [
path(
- "api/user_interviews/vapi_webhook/",
+ "vapi_webhook/",
vapi_webhook,
name="user_interviews_vapi_webhook",
),
diff --git a/products/workflows/backend/routes.py b/products/workflows/backend/routes.py
index e2ef426d81c2..723ca1b48e32 100644
--- a/products/workflows/backend/routes.py
+++ b/products/workflows/backend/routes.py
@@ -9,9 +9,9 @@ from products.workflows.backend.api import hog_flow, hog_flow_template, workflow
# AWS SES tenant reputation events, delivered EventBridge -> SNS HTTPS subscription. Workflows owns
# the topic and its allowlist setting, so the route is mounted here rather than in core.
-urlpatterns: list[URLPattern] = [
+webhook_urlpatterns: list[URLPattern] = [
opt_slash_path(
- "webhooks/workflows/ses-events",
+ "ses-events",
build_webhook_view(build_sns_provider(topic_arns_setting="WORKFLOWS_SES_EVENTS_SNS_TOPIC_ARNS")),
),
]