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(cdp): move the template registry into products/cdp and remove posthog/cdp (#116087)

Harley Alexanderc17c09a30288
diff --git a/.agents/skills/adding-product-alerting/references/extending-platform-alerting.md b/.agents/skills/adding-product-alerting/references/extending-platform-alerting.md
index f1f4c4b124cb..489065c8e8ee 100644
--- a/.agents/skills/adding-product-alerting/references/extending-platform-alerting.md
+++ b/.agents/skills/adding-product-alerting/references/extending-platform-alerting.md
@@ -44,7 +44,7 @@ A new destination type normally requires all of these:
1. Add the enum value in `products/alerts_platform/backend/facade/contracts.py`, and the HogFunction template ID and required fields in `products/alerts/backend/logic/destination_configs.py`.
2. Extend validation and `build_alert_destination_config(...)` without changing existing payloads.
-3. Add the transport template under `nodejs/src/cdp/templates/_destinations/<destination>/<destination>.template.ts`, register it in `nodejs/src/cdp/templates/index.ts`, and test it with `TemplateTester` next to it. Django tests that need the template in the database sync a stand-in from `posthog/cdp/templates/fixtures.py`; its inputs schema must track which inputs are secret, because that decides what a saved destination keeps in `inputs` versus `encrypted_inputs`. Only update an existing template under `posthog/cdp/templates/` when it already lives there.
+3. Add the transport template under `nodejs/src/cdp/templates/_destinations/<destination>/<destination>.template.ts`, register it in `nodejs/src/cdp/templates/index.ts`, and test it with `TemplateTester` next to it. Django tests that need the template in the database sync a stand-in from `products/cdp/backend/templates/fixtures.py`; its inputs schema must track which inputs are secret, because that decides what a saved destination keeps in `inputs` versus `encrypted_inputs`. Only update an existing template under `products/cdp/backend/templates/` when it already lives there.
4. Add alert-specific template compatibility in `frontend/src/scenes/hog-functions/sub-templates/sub-templates.ts`.
5. Decide which products explicitly allow the destination and update their destination editors or display logic.
6. Add the option to `AlertWizard` only where supported by the relevant sub-template.
diff --git a/posthog/cdp/templates/__init__.py b/posthog/cdp/templates/__init__.py
deleted file mode 100644
index d847ff9da1c1..000000000000
--- a/posthog/cdp/templates/__init__.py
+++ /dev/null
@@ -1,157 +0,0 @@
-from products.cdp.backend.templates._internal.template_blank import blank_site_app, blank_site_destination
-from products.cdp.backend.templates.activecampaign.template_activecampaign import template as activecampaign
-from products.cdp.backend.templates.airtable.template_airtable import template as airtable
-from products.cdp.backend.templates.attio.template_attio import template as attio
-from products.cdp.backend.templates.avo.template_avo import (
- TemplateAvoMigrator,
- template as avo,
-)
-from products.cdp.backend.templates.aws_kinesis.template_aws_kinesis import template as aws_kinesis
-from products.cdp.backend.templates.braze.template_braze import template as braze
-from products.cdp.backend.templates.brevo.template_brevo import template as brevo
-from products.cdp.backend.templates.clearbit.template_clearbit import template as clearbit
-from products.cdp.backend.templates.customerio.template_customerio import (
- TemplateCustomerioMigrator,
- template as customerio,
-)
-from products.cdp.backend.templates.discord.template_discord import template as discord
-from products.cdp.backend.templates.engage.template_engage import (
- TemplateEngageMigrator,
- template as engage,
-)
-from products.cdp.backend.templates.gleap.template_gleap import template as gleap
-from products.cdp.backend.templates.google_cloud_storage.template_google_cloud_storage import (
- TemplateGoogleCloudStorageMigrator,
- template as google_cloud_storage,
-)
-from products.cdp.backend.templates.google_pubsub.template_google_pubsub import (
- TemplateGooglePubSubMigrator,
- template as google_pubsub,
-)
-from products.cdp.backend.templates.hubspot.template_hubspot import (
- TemplateHubspotMigrator,
- template as hubspot,
- template_event as hubspot_event,
-)
-from products.cdp.backend.templates.intercom.template_intercom import (
- template as intercom,
- template_send_event as intercom_send_event,
-)
-from products.cdp.backend.templates.june.template_june import template as june
-from products.cdp.backend.templates.klaviyo.template_klaviyo import (
- template_event as klaviyo_event,
- template_user as klaviyo_user,
-)
-from products.cdp.backend.templates.kudosity.template_kudosity import template as kudosity
-from products.cdp.backend.templates.loops.template_loops import (
- TemplateLoopsMigrator,
- template as loops,
- template_send_event as loops_send_event,
-)
-from products.cdp.backend.templates.mailchimp.template_mailchimp import template as mailchimp
-from products.cdp.backend.templates.mailgun.template_mailgun import template_mailgun_send_email as mailgun
-from products.cdp.backend.templates.mailjet.template_mailjet import (
- template_create_contact as mailjet_create_contact,
- template_update_contact_list as mailjet_update_contact_list,
-)
-from products.cdp.backend.templates.make.template_make import template as make
-from products.cdp.backend.templates.microsoft_teams.template_microsoft_teams import template as microsoft_teams
-from products.cdp.backend.templates.onesignal.template_onesignal import template as onesignal
-from products.cdp.backend.templates.posthog.template_posthog import (
- TemplatePostHogMigrator,
- template as posthog,
-)
-from products.cdp.backend.templates.reddit.template_reddit_pixel import template_reddit_pixel as reddit_pixel
-from products.cdp.backend.templates.rudderstack.template_rudderstack import (
- TemplateRudderstackMigrator,
- template as rudderstack,
-)
-from products.cdp.backend.templates.salesforce.template_salesforce import (
- template_create as salesforce_create,
- template_lookup as salesforce_lookup,
- template_update as salesforce_update,
-)
-from products.cdp.backend.templates.sendgrid.template_sendgrid import (
- TemplateSendGridMigrator,
- template as sendgrid,
-)
-from products.cdp.backend.templates.snapchat_ads.template_pixel import template_snapchat_pixel as snapchat_pixel
-from products.cdp.backend.templates.tiktok_ads.template_tiktok_pixel import template_tiktok_pixel as tiktok_pixel
-from products.cdp.backend.templates.userlist.template_userlist import template as userlist
-from products.cdp.backend.templates.zendesk.template_zendesk import template as zendesk
-
-from ._siteapps.template_debug_posthog import template as debug_posthog
-from ._siteapps.template_early_access_features import template as early_access_features
-from ._siteapps.template_hogdesk import template as hogdesk
-from ._siteapps.template_notification_bar import template as notification_bar
-from ._siteapps.template_pineapple_mode import template as pineapple_mode
-from .knock.template_knock import template as knock
-from .zapier.template_zapier import template as zapier
-
-HOG_FUNCTION_TEMPLATES = [
- blank_site_destination,
- blank_site_app,
- activecampaign,
- airtable,
- attio,
- avo,
- aws_kinesis,
- braze,
- brevo,
- clearbit,
- customerio,
- discord,
- engage,
- gleap,
- google_cloud_storage,
- google_pubsub,
- hubspot,
- hubspot_event,
- intercom,
- intercom_send_event,
- june,
- klaviyo_event,
- klaviyo_user,
- knock,
- kudosity,
- loops,
- loops_send_event,
- mailchimp,
- mailgun,
- mailjet_create_contact,
- mailjet_update_contact_list,
- make,
- microsoft_teams,
- onesignal,
- posthog,
- reddit_pixel,
- rudderstack,
- salesforce_create,
- salesforce_lookup,
- salesforce_update,
- sendgrid,
- snapchat_pixel,
- tiktok_pixel,
- userlist,
- zapier,
- zendesk,
- early_access_features,
- hogdesk,
- notification_bar,
- pineapple_mode,
- debug_posthog,
-]
-
-
-HOG_FUNCTION_MIGRATORS = {
- TemplateCustomerioMigrator.plugin_url: TemplateCustomerioMigrator,
- TemplateSendGridMigrator.plugin_url: TemplateSendGridMigrator,
- TemplateGooglePubSubMigrator.plugin_url: TemplateGooglePubSubMigrator,
- TemplateGoogleCloudStorageMigrator.plugin_url: TemplateGoogleCloudStorageMigrator,
- TemplateEngageMigrator.plugin_url: TemplateEngageMigrator,
- TemplatePostHogMigrator.plugin_url: TemplatePostHogMigrator,
- TemplateHubspotMigrator.plugin_url: TemplateHubspotMigrator,
- TemplateRudderstackMigrator.plugin_url: TemplateRudderstackMigrator,
- TemplateLoopsMigrator.plugin_url: TemplateLoopsMigrator,
- TemplateAvoMigrator.plugin_url: TemplateAvoMigrator,
-}
diff --git a/posthog/cdp/templates/hog_function_template.py b/posthog/cdp/templates/hog_function_template.py
deleted file mode 100644
index b331633dd2d7..000000000000
--- a/posthog/cdp/templates/hog_function_template.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from products.cdp.backend.templates.hog_function_template import (
- HogFunctionMapping as HogFunctionMapping,
- HogFunctionMappingTemplate as HogFunctionMappingTemplate,
- HogFunctionTemplateDC as HogFunctionTemplateDC,
- HogFunctionTemplateMigrator as HogFunctionTemplateMigrator,
- HogFunctionTemplateType as HogFunctionTemplateType,
- SubTemplateId as SubTemplateId,
- sync_template_to_db as sync_template_to_db,
-)
diff --git a/posthog/management/commands/sync_hog_function_templates.py b/posthog/management/commands/sync_hog_function_templates.py
index ee4a88782ff6..404d68b14e23 100644
--- a/posthog/management/commands/sync_hog_function_templates.py
+++ b/posthog/management/commands/sync_hog_function_templates.py
@@ -6,11 +6,11 @@ from django.core.management.base import BaseCommand
import structlog
-from posthog.cdp.templates import HOG_FUNCTION_TEMPLATES
from posthog.plugins.plugin_server_api import get_hog_function_templates
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions.hog_function import HogFunctionType
+from products.cdp.backend.templates import HOG_FUNCTION_TEMPLATES
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.warehouse_sources.backend.facade.source_management import (
SourceRegistry,
diff --git a/posthog/management/commands/test/test_migrate_hooks.py b/posthog/management/commands/test/test_migrate_hooks.py
index baa8fe59349a..f132c7354925 100644
--- a/posthog/management/commands/test/test_migrate_hooks.py
+++ b/posthog/management/commands/test/test_migrate_hooks.py
@@ -1,13 +1,13 @@
from posthog.test.base import BaseTest
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
-from posthog.cdp.templates.zapier.template_zapier import template as template_zapier
from posthog.management.commands.migrate_hooks import migrate_hooks
from products.actions.backend.models.action import Action
from products.cdp.backend.filters import RUNTIME_CONTRACT
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.hook import Hook
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
+from products.cdp.backend.templates.zapier.template_zapier import template as template_zapier
from common.hogvm.python.operation import HOGQL_BYTECODE_VERSION
diff --git a/posthog/management/commands/test/test_sync_hog_function_templates.py b/posthog/management/commands/test/test_sync_hog_function_templates.py
index 8a981fb54053..d021b8006bb7 100644
--- a/posthog/management/commands/test/test_sync_hog_function_templates.py
+++ b/posthog/management/commands/test/test_sync_hog_function_templates.py
@@ -3,7 +3,6 @@ from unittest.mock import MagicMock, patch
from django.core.management import call_command
-from posthog.cdp.templates import HOG_FUNCTION_TEMPLATES
from posthog.management.commands.sync_hog_function_templates import (
TEST_INCLUDE_NODEJS_TEMPLATE_IDS,
TEST_INCLUDE_PYTHON_TEMPLATE_IDS,
@@ -11,6 +10,7 @@ from posthog.management.commands.sync_hog_function_templates import (
)
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+from products.cdp.backend.templates import HOG_FUNCTION_TEMPLATES
pytestmark = pytest.mark.django_db
diff --git a/posthog/models/test/test_hog_function_template.py b/posthog/models/test/test_hog_function_template.py
index f646a592fad4..64a9b0c7e53b 100644
--- a/posthog/models/test/test_hog_function_template.py
+++ b/posthog/models/test/test_hog_function_template.py
@@ -1,8 +1,7 @@
from django.test import TestCase
-from posthog.cdp.templates.fixtures import template_slack as slack_template
-
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+from products.cdp.backend.templates.fixtures import template_slack as slack_template
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.py
index bc2bf4476deb..5df56630fa13 100644
--- a/posthog/models/test/test_remote_config.py
+++ b/posthog/models/test/test_remote_config.py
@@ -11,13 +11,13 @@ from django.utils import timezone
from parameterized import parameterized
-from posthog.cdp.templates.helpers import mock_transpile
from posthog.models.integration import Integration
from posthog.models.project import Project
from posthog.models.remote_config import REMOTE_CONFIG_CACHE_EXPIRY_SORTED_SET, RemoteConfig
from products.actions.backend.models.action import Action
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.templates.helpers import mock_transpile
from products.feature_flags.backend.models.feature_flag import FeatureFlag
from products.surveys.backend.models import Survey
diff --git a/posthog/test/test_plugin.py b/posthog/test/test_plugin.py
index 2b960d32161c..93d088f54d8c 100644
--- a/posthog/test/test_plugin.py
+++ b/posthog/test/test_plugin.py
@@ -5,7 +5,6 @@ from unittest.mock import patch
from django.core import exceptions
-from posthog.cdp.templates.helpers import mock_transpile
from posthog.plugins.test.plugin_archives import (
HELLO_WORLD_PLUGIN_FRONTEND_TSX,
HELLO_WORLD_PLUGIN_GITHUB_INDEX_JS,
@@ -24,6 +23,7 @@ from posthog.plugins.test.plugin_archives import (
)
from products.cdp.backend.models.plugin import Plugin, PluginSourceFile
+from products.cdp.backend.templates.helpers import mock_transpile
class TestPlugin(BaseTest):
diff --git a/products/alerts/backend/test/test_destination_configs.py b/products/alerts/backend/test/test_destination_configs.py
index bf95fd119a00..8a1d5d5a127b 100644
--- a/products/alerts/backend/test/test_destination_configs.py
+++ b/products/alerts/backend/test/test_destination_configs.py
@@ -3,9 +3,6 @@ from typing import Any
import pytest
-from posthog.cdp.templates import HOG_FUNCTION_TEMPLATES
-from posthog.cdp.templates.fixtures import template_pagerduty
-
from products.alerts.backend.logic.destination_configs import (
DESTINATION_SPECS,
build_alert_destination_config,
@@ -23,6 +20,8 @@ from products.alerts_platform.backend.facade.contracts import (
EventKindSpec,
IncidentAction,
)
+from products.cdp.backend.templates import HOG_FUNCTION_TEMPLATES
+from products.cdp.backend.templates.fixtures import template_pagerduty
DEFAULT_SPEC = EventKindSpec(
event_id="$insight_alert_firing",
diff --git a/products/alerts/backend/tests/api/test_alert.py b/products/alerts/backend/tests/api/test_alert.py
index 1a00771b1bc2..2793d95af0e5 100644
--- a/products/alerts/backend/tests/api/test_alert.py
+++ b/products/alerts/backend/tests/api/test_alert.py
@@ -15,7 +15,6 @@ from rest_framework import status
from posthog.schema import AlertCalculationInterval, AlertConditionType, AlertState, InsightThresholdType
from posthog.api.tagged_item import set_tags_on_object
-from posthog.cdp.templates.fixtures import template_slack
from posthog.constants import AvailableFeature
from posthog.models import User
from posthog.models.integration import Integration
@@ -33,6 +32,7 @@ from products.alerts.backend.presentation.views.alert import AlertSerializer
from products.alerts_platform.backend.facade.contracts import AlertDelivery
from products.alerts_platform.backend.facade.scheduling import CalendarInterval, alert_check_offset
from products.cdp.backend.facade.models import HogFunction
+from products.cdp.backend.templates.fixtures import template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.product_analytics.backend.facade.models import Insight
diff --git a/products/cdp/backend/api/hooks.py b/products/cdp/backend/api/hooks.py
index 2338661c821e..8158152c531d 100644
--- a/products/cdp/backend/api/hooks.py
+++ b/products/cdp/backend/api/hooks.py
@@ -8,12 +8,12 @@ from rest_framework import exceptions, mixins, serializers, status, viewsets
from rest_framework.response import Response
from posthog.api.routing import TeamAndOrgViewSetMixin
-from posthog.cdp.templates.zapier.template_zapier import template as template_zapier
from posthog.models.user import User
from products.cdp.backend.api.hog_function import HogFunctionSerializer
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.hook import HOOK_EVENTS, Hook
+from products.cdp.backend.templates.zapier.template_zapier import template as template_zapier
def create_zapier_hog_function(hook: Hook, serializer_context: dict, from_migration: bool = False) -> HogFunction:
diff --git a/products/cdp/backend/api/plugin.py b/products/cdp/backend/api/plugin.py
index 89bde4e43ead..863376a53bb7 100644
--- a/products/cdp/backend/api/plugin.py
+++ b/products/cdp/backend/api/plugin.py
@@ -21,7 +21,6 @@ from rest_framework.response import Response
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.api.utils import ClassicBehaviorBooleanFieldSerializer, action
-from posthog.cdp.templates import HOG_FUNCTION_MIGRATORS
from posthog.event_usage import report_user_action
from posthog.helpers.impersonation import is_impersonated
from posthog.models import User
@@ -53,6 +52,7 @@ from products.cdp.backend.models.plugin import (
transpile,
update_validated_data_from_url,
)
+from products.cdp.backend.templates import HOG_FUNCTION_MIGRATORS
# Keep this in sync with: frontend/scenes/plugins/utils.ts
SECRET_FIELD_VALUE = "**************** POSTHOG SECRET FIELD ****************"
diff --git a/products/cdp/backend/api/test/test_hog_function.py b/products/cdp/backend/api/test/test_hog_function.py
index 45f24c892c74..a6b000558792 100644
--- a/products/cdp/backend/api/test/test_hog_function.py
+++ b/products/cdp/backend/api/test/test_hog_function.py
@@ -10,9 +10,6 @@ from django.db import connection
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.templates.fixtures import template_slack
-from posthog.cdp.templates.helpers import mock_transpile
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.models.integration import Integration
from products.actions.backend.models.action import Action
@@ -26,6 +23,9 @@ from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_
from products.cdp.backend.filters import RUNTIME_CONTRACT
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions.hog_function import DEFAULT_STATE, HogFunction, HogFunctionState
+from products.cdp.backend.templates.fixtures import template_slack
+from products.cdp.backend.templates.helpers import mock_transpile
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.cohorts.backend.models.cohort import Cohort
from common.hogvm.python.operation import HOGQL_BYTECODE_VERSION, Operation
diff --git a/products/cdp/backend/api/test/test_hog_function_drafts.py b/products/cdp/backend/api/test/test_hog_function_drafts.py
index a7f1493499fb..c97e1302e5bf 100644
--- a/products/cdp/backend/api/test/test_hog_function_drafts.py
+++ b/products/cdp/backend/api/test/test_hog_function_drafts.py
@@ -6,12 +6,12 @@ from unittest.mock import patch
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.templates.helpers import mock_transpile
from posthog.models.activity_logging.activity_log import ActivityLog
from products.cdp.backend.api.hog_function import HogFunctionViewSet
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.hog_functions.hog_function_revision import HogFunctionRevision
+from products.cdp.backend.templates.helpers import mock_transpile
RELOAD_PATH = "products.cdp.backend.models.hog_functions.hog_function.reload_hog_functions_on_workers"
diff --git a/products/cdp/backend/api/test/test_hog_function_templates.py b/products/cdp/backend/api/test/test_hog_function_templates.py
index 1fa7bcc7cfe2..b35eb9bdde81 100644
--- a/products/cdp/backend/api/test/test_hog_function_templates.py
+++ b/products/cdp/backend/api/test/test_hog_function_templates.py
@@ -7,13 +7,13 @@ from unittest.mock import patch
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.templates.fixtures import template_slack
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.models.personal_api_key import PersonalAPIKey
from posthog.models.utils import generate_random_token_personal, hash_key_value
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.templates.fixtures import template_slack
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
MOCK_NODE_TEMPLATES = json.loads(
open(os.path.join(os.path.dirname(__file__), "__data__/hog_function_templates.json")).read()
@@ -198,7 +198,7 @@ class TestHogFunctionTemplates(ClickhouseTestMixin, APIBaseTest, QueryMatchingTe
def test_template_updates_are_reflected(self):
"""Test that template updates are reflected in API responses"""
- from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+ from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
# Initial sha of the template
initial_response = self.client.get("/api/projects/@current/hog_function_templates/template-slack")
diff --git a/products/cdp/backend/api/test/test_hooks.py b/products/cdp/backend/api/test/test_hooks.py
index e736a52fe23b..809c09b57128 100644
--- a/products/cdp/backend/api/test/test_hooks.py
+++ b/products/cdp/backend/api/test/test_hooks.py
@@ -4,14 +4,13 @@ from typing import Any
import pytest
from posthog.test.base import ClickhouseTestMixin
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
-from posthog.cdp.templates.zapier.template_zapier import template as template_zapier
-
from products.actions.backend.models.action import Action
from products.cdp.backend.api.hooks import create_zapier_hog_function, valid_domain
from products.cdp.backend.filters import RUNTIME_CONTRACT
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.hook import Hook
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
+from products.cdp.backend.templates.zapier.template_zapier import template as template_zapier
from common.hogvm.python.operation import HOGQL_BYTECODE_VERSION
from ee.api.test.base import APILicensedTest
diff --git a/products/cdp/backend/api/test/test_plugin.py b/products/cdp/backend/api/test/test_plugin.py
index 8491e146b67c..7eb85e21ddf7 100644
--- a/products/cdp/backend/api/test/test_plugin.py
+++ b/products/cdp/backend/api/test/test_plugin.py
@@ -15,8 +15,6 @@ from django.test import override_settings
from rest_framework import status
-from posthog.cdp.templates.helpers import mock_transpile
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.constants import FROZEN_POSTHOG_VERSION
from posthog.models.organization import Organization, OrganizationMembership
from posthog.models.team.team import Team
@@ -29,6 +27,8 @@ from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_
from products.cdp.backend.filters import RUNTIME_CONTRACT
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.plugin import Plugin, PluginConfig, PluginSourceFile
+from products.cdp.backend.templates.helpers import mock_transpile
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
def mocked_plugin_reload(*args, **kwargs):
diff --git a/products/cdp/backend/models/hog_functions/hog_function.py b/products/cdp/backend/models/hog_functions/hog_function.py
index 7fa912188c07..f7726ce9f05e 100644
--- a/products/cdp/backend/models/hog_functions/hog_function.py
+++ b/products/cdp/backend/models/hog_functions/hog_function.py
@@ -422,11 +422,11 @@ def team_inject_web_apps_changd(sender, instance, created=None, **kwargs):
@receiver(models.signals.post_save, sender=Team)
def enabled_default_hog_functions_for_new_team(sender, instance: Team, created: bool, **kwargs):
- from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.plugins.plugin_server_api import get_hog_function_templates
from products.cdp.backend.api.hog_function import HogFunctionSerializer
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+ from products.cdp.backend.templates.hog_function_template import sync_template_to_db
if settings.DISABLE_MMDB or not created:
return
diff --git a/posthog/cdp/templates/README.md b/products/cdp/backend/templates/README.md
similarity index 100%
rename from posthog/cdp/templates/README.md
rename to products/cdp/backend/templates/README.md
diff --git a/products/cdp/backend/templates/__init__.py b/products/cdp/backend/templates/__init__.py
index e69de29bb2d1..d847ff9da1c1 100644
--- a/products/cdp/backend/templates/__init__.py
+++ b/products/cdp/backend/templates/__init__.py
@@ -0,0 +1,157 @@
+from products.cdp.backend.templates._internal.template_blank import blank_site_app, blank_site_destination
+from products.cdp.backend.templates.activecampaign.template_activecampaign import template as activecampaign
+from products.cdp.backend.templates.airtable.template_airtable import template as airtable
+from products.cdp.backend.templates.attio.template_attio import template as attio
+from products.cdp.backend.templates.avo.template_avo import (
+ TemplateAvoMigrator,
+ template as avo,
+)
+from products.cdp.backend.templates.aws_kinesis.template_aws_kinesis import template as aws_kinesis
+from products.cdp.backend.templates.braze.template_braze import template as braze
+from products.cdp.backend.templates.brevo.template_brevo import template as brevo
+from products.cdp.backend.templates.clearbit.template_clearbit import template as clearbit
+from products.cdp.backend.templates.customerio.template_customerio import (
+ TemplateCustomerioMigrator,
+ template as customerio,
+)
+from products.cdp.backend.templates.discord.template_discord import template as discord
+from products.cdp.backend.templates.engage.template_engage import (
+ TemplateEngageMigrator,
+ template as engage,
+)
+from products.cdp.backend.templates.gleap.template_gleap import template as gleap
+from products.cdp.backend.templates.google_cloud_storage.template_google_cloud_storage import (
+ TemplateGoogleCloudStorageMigrator,
+ template as google_cloud_storage,
+)
+from products.cdp.backend.templates.google_pubsub.template_google_pubsub import (
+ TemplateGooglePubSubMigrator,
+ template as google_pubsub,
+)
+from products.cdp.backend.templates.hubspot.template_hubspot import (
+ TemplateHubspotMigrator,
+ template as hubspot,
+ template_event as hubspot_event,
+)
+from products.cdp.backend.templates.intercom.template_intercom import (
+ template as intercom,
+ template_send_event as intercom_send_event,
+)
+from products.cdp.backend.templates.june.template_june import template as june
+from products.cdp.backend.templates.klaviyo.template_klaviyo import (
+ template_event as klaviyo_event,
+ template_user as klaviyo_user,
+)
+from products.cdp.backend.templates.kudosity.template_kudosity import template as kudosity
+from products.cdp.backend.templates.loops.template_loops import (
+ TemplateLoopsMigrator,
+ template as loops,
+ template_send_event as loops_send_event,
+)
+from products.cdp.backend.templates.mailchimp.template_mailchimp import template as mailchimp
+from products.cdp.backend.templates.mailgun.template_mailgun import template_mailgun_send_email as mailgun
+from products.cdp.backend.templates.mailjet.template_mailjet import (
+ template_create_contact as mailjet_create_contact,
+ template_update_contact_list as mailjet_update_contact_list,
+)
+from products.cdp.backend.templates.make.template_make import template as make
+from products.cdp.backend.templates.microsoft_teams.template_microsoft_teams import template as microsoft_teams
+from products.cdp.backend.templates.onesignal.template_onesignal import template as onesignal
+from products.cdp.backend.templates.posthog.template_posthog import (
+ TemplatePostHogMigrator,
+ template as posthog,
+)
+from products.cdp.backend.templates.reddit.template_reddit_pixel import template_reddit_pixel as reddit_pixel
+from products.cdp.backend.templates.rudderstack.template_rudderstack import (
+ TemplateRudderstackMigrator,
+ template as rudderstack,
+)
+from products.cdp.backend.templates.salesforce.template_salesforce import (
+ template_create as salesforce_create,
+ template_lookup as salesforce_lookup,
+ template_update as salesforce_update,
+)
+from products.cdp.backend.templates.sendgrid.template_sendgrid import (
+ TemplateSendGridMigrator,
+ template as sendgrid,
+)
+from products.cdp.backend.templates.snapchat_ads.template_pixel import template_snapchat_pixel as snapchat_pixel
+from products.cdp.backend.templates.tiktok_ads.template_tiktok_pixel import template_tiktok_pixel as tiktok_pixel
+from products.cdp.backend.templates.userlist.template_userlist import template as userlist
+from products.cdp.backend.templates.zendesk.template_zendesk import template as zendesk
+
+from ._siteapps.template_debug_posthog import template as debug_posthog
+from ._siteapps.template_early_access_features import template as early_access_features
+from ._siteapps.template_hogdesk import template as hogdesk
+from ._siteapps.template_notification_bar import template as notification_bar
+from ._siteapps.template_pineapple_mode import template as pineapple_mode
+from .knock.template_knock import template as knock
+from .zapier.template_zapier import template as zapier
+
+HOG_FUNCTION_TEMPLATES = [
+ blank_site_destination,
+ blank_site_app,
+ activecampaign,
+ airtable,
+ attio,
+ avo,
+ aws_kinesis,
+ braze,
+ brevo,
+ clearbit,
+ customerio,
+ discord,
+ engage,
+ gleap,
+ google_cloud_storage,
+ google_pubsub,
+ hubspot,
+ hubspot_event,
+ intercom,
+ intercom_send_event,
+ june,
+ klaviyo_event,
+ klaviyo_user,
+ knock,
+ kudosity,
+ loops,
+ loops_send_event,
+ mailchimp,
+ mailgun,
+ mailjet_create_contact,
+ mailjet_update_contact_list,
+ make,
+ microsoft_teams,
+ onesignal,
+ posthog,
+ reddit_pixel,
+ rudderstack,
+ salesforce_create,
+ salesforce_lookup,
+ salesforce_update,
+ sendgrid,
+ snapchat_pixel,
+ tiktok_pixel,
+ userlist,
+ zapier,
+ zendesk,
+ early_access_features,
+ hogdesk,
+ notification_bar,
+ pineapple_mode,
+ debug_posthog,
+]
+
+
+HOG_FUNCTION_MIGRATORS = {
+ TemplateCustomerioMigrator.plugin_url: TemplateCustomerioMigrator,
+ TemplateSendGridMigrator.plugin_url: TemplateSendGridMigrator,
+ TemplateGooglePubSubMigrator.plugin_url: TemplateGooglePubSubMigrator,
+ TemplateGoogleCloudStorageMigrator.plugin_url: TemplateGoogleCloudStorageMigrator,
+ TemplateEngageMigrator.plugin_url: TemplateEngageMigrator,
+ TemplatePostHogMigrator.plugin_url: TemplatePostHogMigrator,
+ TemplateHubspotMigrator.plugin_url: TemplateHubspotMigrator,
+ TemplateRudderstackMigrator.plugin_url: TemplateRudderstackMigrator,
+ TemplateLoopsMigrator.plugin_url: TemplateLoopsMigrator,
+ TemplateAvoMigrator.plugin_url: TemplateAvoMigrator,
+}
diff --git a/posthog/cdp/templates/_siteapps/template_debug_posthog.py b/products/cdp/backend/templates/_siteapps/template_debug_posthog.py
similarity index 94%
rename from posthog/cdp/templates/_siteapps/template_debug_posthog.py
rename to products/cdp/backend/templates/_siteapps/template_debug_posthog.py
index 952300a54abc..b962ddd94035 100644
--- a/posthog/cdp/templates/_siteapps/template_debug_posthog.py
+++ b/products/cdp/backend/templates/_siteapps/template_debug_posthog.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
diff --git a/posthog/cdp/templates/_siteapps/template_early_access_features.py b/products/cdp/backend/templates/_siteapps/template_early_access_features.py
similarity index 99%
rename from posthog/cdp/templates/_siteapps/template_early_access_features.py
rename to products/cdp/backend/templates/_siteapps/template_early_access_features.py
index 300d80740365..07c8edd9e9a3 100644
--- a/posthog/cdp/templates/_siteapps/template_early_access_features.py
+++ b/products/cdp/backend/templates/_siteapps/template_early_access_features.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
diff --git a/posthog/cdp/templates/_siteapps/template_hogdesk.py b/products/cdp/backend/templates/_siteapps/template_hogdesk.py
similarity index 99%
rename from posthog/cdp/templates/_siteapps/template_hogdesk.py
rename to products/cdp/backend/templates/_siteapps/template_hogdesk.py
index 699b763702c8..f6565562ba1e 100644
--- a/posthog/cdp/templates/_siteapps/template_hogdesk.py
+++ b/products/cdp/backend/templates/_siteapps/template_hogdesk.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
diff --git a/posthog/cdp/templates/_siteapps/template_notification_bar.py b/products/cdp/backend/templates/_siteapps/template_notification_bar.py
similarity index 98%
rename from posthog/cdp/templates/_siteapps/template_notification_bar.py
rename to products/cdp/backend/templates/_siteapps/template_notification_bar.py
index 6061dc988f28..c53c09df9c85 100644
--- a/posthog/cdp/templates/_siteapps/template_notification_bar.py
+++ b/products/cdp/backend/templates/_siteapps/template_notification_bar.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
diff --git a/posthog/cdp/templates/_siteapps/template_pineapple_mode.py b/products/cdp/backend/templates/_siteapps/template_pineapple_mode.py
similarity index 98%
rename from posthog/cdp/templates/_siteapps/template_pineapple_mode.py
rename to products/cdp/backend/templates/_siteapps/template_pineapple_mode.py
index 097fdc96f46d..d10ff694f673 100644
--- a/posthog/cdp/templates/_siteapps/template_pineapple_mode.py
+++ b/products/cdp/backend/templates/_siteapps/template_pineapple_mode.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
diff --git a/products/cdp/backend/templates/activecampaign/test_template_activecampaign.py b/products/cdp/backend/templates/activecampaign/test_template_activecampaign.py
index 7cb0d0c3ea08..c49484023fc6 100644
--- a/products/cdp/backend/templates/activecampaign/test_template_activecampaign.py
+++ b/products/cdp/backend/templates/activecampaign/test_template_activecampaign.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.activecampaign.template_activecampaign import template as template_activecampaign
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
def create_inputs(**kwargs):
diff --git a/products/cdp/backend/templates/airtable/test_template_airtable.py b/products/cdp/backend/templates/airtable/test_template_airtable.py
index c276709b2867..a04594a2765c 100644
--- a/products/cdp/backend/templates/airtable/test_template_airtable.py
+++ b/products/cdp/backend/templates/airtable/test_template_airtable.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.airtable.template_airtable import template as template_airtable
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateAirtable(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/attio/test_template_attio.py b/products/cdp/backend/templates/attio/test_template_attio.py
index d9c82e6d667e..fed5e0dd129f 100644
--- a/products/cdp/backend/templates/attio/test_template_attio.py
+++ b/products/cdp/backend/templates/attio/test_template_attio.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.attio.template_attio import template as template_attio
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
def create_inputs(**kwargs):
diff --git a/products/cdp/backend/templates/avo/test_template_avo.py b/products/cdp/backend/templates/avo/test_template_avo.py
index 85d01728e04e..06d4bfcba9e2 100644
--- a/products/cdp/backend/templates/avo/test_template_avo.py
+++ b/products/cdp/backend/templates/avo/test_template_avo.py
@@ -1,12 +1,11 @@
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
from products.cdp.backend.templates.avo.template_avo import (
TemplateAvoMigrator,
template as template_avo,
)
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateAvo(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/aws_kinesis/test_template_aws_kinesis.py b/products/cdp/backend/templates/aws_kinesis/test_template_aws_kinesis.py
index 6e068a2576d4..f0dece77e342 100644
--- a/products/cdp/backend/templates/aws_kinesis/test_template_aws_kinesis.py
+++ b/products/cdp/backend/templates/aws_kinesis/test_template_aws_kinesis.py
@@ -1,8 +1,7 @@
import time_machine
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.aws_kinesis.template_aws_kinesis import template as template_aws_kinesis
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateAwsKinesis(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/braze/test_template_braze.py b/products/cdp/backend/templates/braze/test_template_braze.py
index 82ce01e80175..9424e44e3c9b 100644
--- a/products/cdp/backend/templates/braze/test_template_braze.py
+++ b/products/cdp/backend/templates/braze/test_template_braze.py
@@ -1,8 +1,7 @@
import time_machine
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.braze.template_braze import template as template_braze
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateBraze(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/brevo/test_template_brevo.py b/products/cdp/backend/templates/brevo/test_template_brevo.py
index 0f42cdf7efa6..6b7eaa690fdc 100644
--- a/products/cdp/backend/templates/brevo/test_template_brevo.py
+++ b/products/cdp/backend/templates/brevo/test_template_brevo.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.brevo.template_brevo import template as template_brevo
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
def create_inputs(**kwargs):
diff --git a/products/cdp/backend/templates/clearbit/test_template_clearbit.py b/products/cdp/backend/templates/clearbit/test_template_clearbit.py
index 0a58d8eaeccc..cfc53509c175 100644
--- a/products/cdp/backend/templates/clearbit/test_template_clearbit.py
+++ b/products/cdp/backend/templates/clearbit/test_template_clearbit.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.clearbit.template_clearbit import template as template_clearbit
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
EXAMPLE_RESPONSE = {
"person": {
diff --git a/products/cdp/backend/templates/customerio/test_template_customerio.py b/products/cdp/backend/templates/customerio/test_template_customerio.py
index 47fec696c60a..eb4181815982 100644
--- a/products/cdp/backend/templates/customerio/test_template_customerio.py
+++ b/products/cdp/backend/templates/customerio/test_template_customerio.py
@@ -1,13 +1,12 @@
import pytest
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
from products.cdp.backend.templates.customerio.template_customerio import (
TemplateCustomerioMigrator,
template as template_customerio,
)
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from common.hogvm.python.utils import UncaughtHogVMException
diff --git a/products/cdp/backend/templates/discord/test_template_discord.py b/products/cdp/backend/templates/discord/test_template_discord.py
index 5a2eabae6bda..ce325c4dd5a7 100644
--- a/products/cdp/backend/templates/discord/test_template_discord.py
+++ b/products/cdp/backend/templates/discord/test_template_discord.py
@@ -2,9 +2,8 @@ import pytest
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.discord.template_discord import template as template_discord
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateDiscord(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/engage/test_template_engage.py b/products/cdp/backend/templates/engage/test_template_engage.py
index d7d04c9f4dd9..5d805ed2fcb1 100644
--- a/products/cdp/backend/templates/engage/test_template_engage.py
+++ b/products/cdp/backend/templates/engage/test_template_engage.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.engage.template_engage import template as template_engage
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
class TestTemplateEngageso(BaseHogFunctionTemplateTest):
diff --git a/posthog/cdp/templates/fixtures.py b/products/cdp/backend/templates/fixtures.py
similarity index 98%
rename from posthog/cdp/templates/fixtures.py
rename to products/cdp/backend/templates/fixtures.py
index 59b9b1f42716..cb94b48d4307 100644
--- a/posthog/cdp/templates/fixtures.py
+++ b/products/cdp/backend/templates/fixtures.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
# The Slack destination itself lives in nodejs (nodejs/src/cdp/templates/_destinations/slack). Tests
# that need a real destination template in the database sync this stand-in instead of reaching out to
diff --git a/products/cdp/backend/templates/gleap/test_template_gleap.py b/products/cdp/backend/templates/gleap/test_template_gleap.py
index e1c923d43d60..a47203e5b474 100644
--- a/products/cdp/backend/templates/gleap/test_template_gleap.py
+++ b/products/cdp/backend/templates/gleap/test_template_gleap.py
@@ -1,6 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.templates.gleap.template_gleap import template as template_gleap
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
def create_inputs(**kwargs):
diff --git a/posthog/cdp/templates/helpers.py b/products/cdp/backend/templates/helpers.py
similarity index 98%
rename from posthog/cdp/templates/helpers.py
rename to products/cdp/backend/templates/helpers.py
index 863896c65bcd..3a91cf5da480 100644
--- a/posthog/cdp/templates/helpers.py
+++ b/products/cdp/backend/templates/helpers.py
@@ -6,11 +6,11 @@ from typing import Any, Optional, cast
from posthog.test.base import APIBaseTest, BaseTest
from unittest.mock import MagicMock, patch
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC, sync_template_to_db
from posthog.models.utils import uuid7
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.site_functions import get_transpiled_function
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC, sync_template_to_db
from products.cdp.backend.validation import compile_hog
from common.hogvm.python.execute import execute_bytecode
diff --git a/products/cdp/backend/templates/hubspot/test_template_hubspot.py b/products/cdp/backend/templates/hubspot/test_template_hubspot.py
index 5bd919c2d2f8..0f76e778cd70 100644
--- a/products/cdp/backend/templates/hubspot/test_template_hubspot.py
+++ b/products/cdp/backend/templates/hubspot/test_template_hubspot.py
@@ -1,9 +1,8 @@
import pytest
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.hubspot.template_hubspot import (
TemplateHubspotMigrator,
template as template_hubspot,
diff --git a/products/cdp/backend/templates/intercom/test_template_intercom.py b/products/cdp/backend/templates/intercom/test_template_intercom.py
index 3ebef53f0fc8..b937c92ed31e 100644
--- a/products/cdp/backend/templates/intercom/test_template_intercom.py
+++ b/products/cdp/backend/templates/intercom/test_template_intercom.py
@@ -1,7 +1,6 @@
import pytest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.intercom.template_intercom import (
template as template_intercom,
template_send_event as template_intercom_event,
diff --git a/products/cdp/backend/templates/june/test_june_template.py b/products/cdp/backend/templates/june/test_june_template.py
index 240e0666478a..9b477bdea07c 100644
--- a/products/cdp/backend/templates/june/test_june_template.py
+++ b/products/cdp/backend/templates/june/test_june_template.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.june.template_june import template as template_june
diff --git a/products/cdp/backend/templates/klaviyo/test_template_klaviyo.py b/products/cdp/backend/templates/klaviyo/test_template_klaviyo.py
index df49c262b818..b8dd8708f951 100644
--- a/products/cdp/backend/templates/klaviyo/test_template_klaviyo.py
+++ b/products/cdp/backend/templates/klaviyo/test_template_klaviyo.py
@@ -1,7 +1,6 @@
import pytest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.klaviyo.template_klaviyo import (
template_event as klaviyo_event,
template_user as klaviyo_user,
diff --git a/posthog/cdp/templates/knock/template_knock.py b/products/cdp/backend/templates/knock/template_knock.py
similarity index 97%
rename from posthog/cdp/templates/knock/template_knock.py
rename to products/cdp/backend/templates/knock/template_knock.py
index 028eb630a2f9..402ad22190bf 100644
--- a/posthog/cdp/templates/knock/template_knock.py
+++ b/products/cdp/backend/templates/knock/template_knock.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="stable",
diff --git a/posthog/cdp/templates/knock/test_knock_template.py b/products/cdp/backend/templates/knock/test_knock_template.py
similarity index 97%
rename from posthog/cdp/templates/knock/test_knock_template.py
rename to products/cdp/backend/templates/knock/test_knock_template.py
index 30b77e61f115..9910e212e413 100644
--- a/posthog/cdp/templates/knock/test_knock_template.py
+++ b/products/cdp/backend/templates/knock/test_knock_template.py
@@ -2,9 +2,8 @@ from typing import Any
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-from posthog.cdp.templates.knock.template_knock import template as template_knock
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
+from products.cdp.backend.templates.knock.template_knock import template as template_knock
from products.cdp.backend.validation import generate_template_bytecode
from common.hogvm.python.execute import execute_bytecode
diff --git a/products/cdp/backend/templates/kudosity/test_template_kudosity.py b/products/cdp/backend/templates/kudosity/test_template_kudosity.py
index cc4d18d1e702..0ecdd504a905 100644
--- a/products/cdp/backend/templates/kudosity/test_template_kudosity.py
+++ b/products/cdp/backend/templates/kudosity/test_template_kudosity.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.kudosity.template_kudosity import template as template_kudosity
diff --git a/products/cdp/backend/templates/loops/test_template_loops.py b/products/cdp/backend/templates/loops/test_template_loops.py
index 55ac7b237f3f..cfcde95a102c 100644
--- a/products/cdp/backend/templates/loops/test_template_loops.py
+++ b/products/cdp/backend/templates/loops/test_template_loops.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.loops.template_loops import (
template as template_loops,
template_send_event as template_loops_send_event,
diff --git a/products/cdp/backend/templates/mailchimp/test_template_mailchimp.py b/products/cdp/backend/templates/mailchimp/test_template_mailchimp.py
index a9f43be833cb..07f626a12029 100644
--- a/products/cdp/backend/templates/mailchimp/test_template_mailchimp.py
+++ b/products/cdp/backend/templates/mailchimp/test_template_mailchimp.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.mailchimp.template_mailchimp import template as template_mailchimp
diff --git a/products/cdp/backend/templates/mailgun/test_template_mailgun.py b/products/cdp/backend/templates/mailgun/test_template_mailgun.py
index 3e9e4197f58d..1f3d39e07bfc 100644
--- a/products/cdp/backend/templates/mailgun/test_template_mailgun.py
+++ b/products/cdp/backend/templates/mailgun/test_template_mailgun.py
@@ -1,7 +1,6 @@
from typing import Optional
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.mailgun.template_mailgun import template_mailgun_send_email
diff --git a/products/cdp/backend/templates/mailjet/test_template_mailjet.py b/products/cdp/backend/templates/mailjet/test_template_mailjet.py
index 853d629d0511..db0547e0bcfe 100644
--- a/products/cdp/backend/templates/mailjet/test_template_mailjet.py
+++ b/products/cdp/backend/templates/mailjet/test_template_mailjet.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.mailjet.template_mailjet import (
template_create_contact,
template_update_contact_list,
diff --git a/products/cdp/backend/templates/make/test_template_make.py b/products/cdp/backend/templates/make/test_template_make.py
index 201fa99721d0..8e34a7770a68 100644
--- a/products/cdp/backend/templates/make/test_template_make.py
+++ b/products/cdp/backend/templates/make/test_template_make.py
@@ -1,7 +1,6 @@
import pytest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.make.template_make import template as template_make
diff --git a/products/cdp/backend/templates/microsoft_teams/test_template_microsoft_teams.py b/products/cdp/backend/templates/microsoft_teams/test_template_microsoft_teams.py
index 7cd21ed55e11..65cb1ed48c96 100644
--- a/products/cdp/backend/templates/microsoft_teams/test_template_microsoft_teams.py
+++ b/products/cdp/backend/templates/microsoft_teams/test_template_microsoft_teams.py
@@ -1,7 +1,6 @@
import pytest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.microsoft_teams.template_microsoft_teams import template as template_microsoft_teams
diff --git a/products/cdp/backend/templates/onesignal/test_template_onesignal.py b/products/cdp/backend/templates/onesignal/test_template_onesignal.py
index 23ab922567c8..cc7b1a5acb4d 100644
--- a/products/cdp/backend/templates/onesignal/test_template_onesignal.py
+++ b/products/cdp/backend/templates/onesignal/test_template_onesignal.py
@@ -1,8 +1,7 @@
import pytest
import time_machine
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.onesignal.template_onesignal import template as template_onesignal
from common.hogvm.python.utils import UncaughtHogVMException
diff --git a/products/cdp/backend/templates/posthog/test_template_posthog.py b/products/cdp/backend/templates/posthog/test_template_posthog.py
index 58c446e9e138..436e10a03f9b 100644
--- a/products/cdp/backend/templates/posthog/test_template_posthog.py
+++ b/products/cdp/backend/templates/posthog/test_template_posthog.py
@@ -1,8 +1,7 @@
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.posthog.template_posthog import (
TemplatePostHogMigrator,
template as template_posthog,
diff --git a/products/cdp/backend/templates/reddit/test_template_reddit_pixel.py b/products/cdp/backend/templates/reddit/test_template_reddit_pixel.py
index 1a101e3a00d2..53ae104408b4 100644
--- a/products/cdp/backend/templates/reddit/test_template_reddit_pixel.py
+++ b/products/cdp/backend/templates/reddit/test_template_reddit_pixel.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseSiteDestinationFunctionTest
-
+from products.cdp.backend.templates.helpers import BaseSiteDestinationFunctionTest
from products.cdp.backend.templates.reddit.template_reddit_pixel import template_reddit_pixel
TEST_EMAIL = "[email protected]"
diff --git a/products/cdp/backend/templates/rudderstack/test_template_rudderstack.py b/products/cdp/backend/templates/rudderstack/test_template_rudderstack.py
index 82fcc0afef3b..1b1acd0256f3 100644
--- a/products/cdp/backend/templates/rudderstack/test_template_rudderstack.py
+++ b/products/cdp/backend/templates/rudderstack/test_template_rudderstack.py
@@ -1,8 +1,7 @@
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.rudderstack.template_rudderstack import (
TemplateRudderstackMigrator,
template as template_rudderstack,
diff --git a/products/cdp/backend/templates/salesforce/test_template_salesforce.py b/products/cdp/backend/templates/salesforce/test_template_salesforce.py
index 54209fd6e2ed..0ca771e96160 100644
--- a/products/cdp/backend/templates/salesforce/test_template_salesforce.py
+++ b/products/cdp/backend/templates/salesforce/test_template_salesforce.py
@@ -3,9 +3,8 @@ from posthog.test.base import BaseTest
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.salesforce.template_salesforce import (
TemplatSalesforceMigrator,
template_create as template_salesforce_create,
diff --git a/products/cdp/backend/templates/sendgrid/test_template_sendgrid.py b/products/cdp/backend/templates/sendgrid/test_template_sendgrid.py
index 4a2746de0772..36d4a6592d1c 100644
--- a/products/cdp/backend/templates/sendgrid/test_template_sendgrid.py
+++ b/products/cdp/backend/templates/sendgrid/test_template_sendgrid.py
@@ -1,8 +1,7 @@
from posthog.test.base import BaseTest
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
from products.cdp.backend.models.plugin import PluginConfig
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.sendgrid.template_sendgrid import (
TemplateSendGridMigrator,
template as template_sendgrid,
diff --git a/posthog/cdp/templates/test_cdp_templates.py b/products/cdp/backend/templates/test_cdp_templates.py
similarity index 94%
rename from posthog/cdp/templates/test_cdp_templates.py
rename to products/cdp/backend/templates/test_cdp_templates.py
index f538809c9303..0ffed57e8877 100644
--- a/posthog/cdp/templates/test_cdp_templates.py
+++ b/products/cdp/backend/templates/test_cdp_templates.py
@@ -2,11 +2,10 @@ import dataclasses
from posthog.test.base import BaseTest
-from posthog.cdp.templates import HOG_FUNCTION_TEMPLATES
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
-
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions.hog_function import TYPES_WITH_TRANSPILED_FILTERS
+from products.cdp.backend.templates import HOG_FUNCTION_TEMPLATES
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.cdp.backend.validation import InputsSchemaItemSerializer, compile_hog
diff --git a/products/cdp/backend/templates/userlist/test_template_userlist.py b/products/cdp/backend/templates/userlist/test_template_userlist.py
index ab1bd3cce026..adc8286d99e7 100644
--- a/products/cdp/backend/templates/userlist/test_template_userlist.py
+++ b/products/cdp/backend/templates/userlist/test_template_userlist.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.userlist.template_userlist import template as template_userlist
diff --git a/posthog/cdp/templates/zapier/template_zapier.py b/products/cdp/backend/templates/zapier/template_zapier.py
similarity index 96%
rename from posthog/cdp/templates/zapier/template_zapier.py
rename to products/cdp/backend/templates/zapier/template_zapier.py
index d8ed16e72cf3..91e5e99ff790 100644
--- a/posthog/cdp/templates/zapier/template_zapier.py
+++ b/products/cdp/backend/templates/zapier/template_zapier.py
@@ -1,4 +1,4 @@
-from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
+from products.cdp.backend.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="stable",
diff --git a/posthog/cdp/templates/zapier/test_template_zapier.py b/products/cdp/backend/templates/zapier/test_template_zapier.py
similarity index 91%
rename from posthog/cdp/templates/zapier/test_template_zapier.py
rename to products/cdp/backend/templates/zapier/test_template_zapier.py
index 3c986238e11a..f64299dc0074 100644
--- a/posthog/cdp/templates/zapier/test_template_zapier.py
+++ b/products/cdp/backend/templates/zapier/test_template_zapier.py
@@ -1,5 +1,5 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-from posthog.cdp.templates.zapier.template_zapier import template as template_zapier
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
+from products.cdp.backend.templates.zapier.template_zapier import template as template_zapier
class TestTemplateZapier(BaseHogFunctionTemplateTest):
diff --git a/products/cdp/backend/templates/zendesk/test_template_zendesk.py b/products/cdp/backend/templates/zendesk/test_template_zendesk.py
index 63752b4941f9..8d9e58ae6789 100644
--- a/products/cdp/backend/templates/zendesk/test_template_zendesk.py
+++ b/products/cdp/backend/templates/zendesk/test_template_zendesk.py
@@ -1,5 +1,4 @@
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.cdp.backend.templates.zendesk.template_zendesk import template as template_zendesk
diff --git a/products/cdp/backend/test/test_plugin_migrations.py b/products/cdp/backend/test/test_plugin_migrations.py
index 0933eabc3c0b..71984805cc71 100644
--- a/products/cdp/backend/test/test_plugin_migrations.py
+++ b/products/cdp/backend/test/test_plugin_migrations.py
@@ -7,14 +7,13 @@ from django.test import SimpleTestCase
from parameterized import parameterized
-from posthog.cdp.templates._siteapps.template_notification_bar import template as notification_bar
-from posthog.cdp.templates._siteapps.template_pineapple_mode import template as pineapple_mode
-from posthog.cdp.templates.helpers import mock_transpile
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
-
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.plugin import Plugin, PluginConfig, PluginSourceFile
from products.cdp.backend.plugin_migrations import coerce_input_value, migrate_legacy_plugins
+from products.cdp.backend.templates._siteapps.template_notification_bar import template as notification_bar
+from products.cdp.backend.templates._siteapps.template_pineapple_mode import template as pineapple_mode
+from products.cdp.backend.templates.helpers import mock_transpile
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
class TestCoerceInputValue(SimpleTestCase):
diff --git a/products/cdp/backend/test/test_site_functions.py b/products/cdp/backend/test/test_site_functions.py
index c6170eced714..7f8ac786a5ba 100644
--- a/products/cdp/backend/test/test_site_functions.py
+++ b/products/cdp/backend/test/test_site_functions.py
@@ -10,7 +10,6 @@ from django.test import TestCase
from parameterized import parameterized
-from posthog.cdp.templates.helpers import mock_transpile
from posthog.models.organization import Organization
from posthog.models.project import Project
from posthog.models.user import User
@@ -20,6 +19,7 @@ from products.actions.backend.models.action import Action
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
from products.cdp.backend.models.plugin import TranspilerError
from products.cdp.backend.site_functions import get_transpiled_function
+from products.cdp.backend.templates.helpers import mock_transpile
from products.cohorts.backend.models.cohort import Cohort
diff --git a/products/customer_analytics/backend/test/test_event_stream.py b/products/customer_analytics/backend/test/test_event_stream.py
index eb4365e83856..363e4f6fc6ad 100644
--- a/products/customer_analytics/backend/test/test_event_stream.py
+++ b/products/customer_analytics/backend/test/test_event_stream.py
@@ -6,12 +6,12 @@ from django.core.cache import cache
from rest_framework import status
from slack_sdk.errors import SlackApiError
-from posthog.cdp.templates.fixtures import template_slack
from posthog.constants import AvailableFeature
from posthog.models import Integration, Organization, OrganizationMembership, Team
from products.access_control.backend.models.access_control import AccessControl
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.templates.fixtures import template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.customer_analytics.backend.logic.event_stream_destination import _NO_MEMBERS_SENTINEL
from products.customer_analytics.backend.models import EventStream, EventStreamMember, TeamCustomerAnalyticsConfig
diff --git a/products/early_access_features/backend/test/test_early_access_feature.py b/products/early_access_features/backend/test/test_early_access_feature.py
index 600b1e40c460..3e8c47d8e5d8 100644
--- a/products/early_access_features/backend/test/test_early_access_feature.py
+++ b/products/early_access_features/backend/test/test_early_access_feature.py
@@ -37,7 +37,7 @@ class TestEarlyAccessFeatureSiteAppTemplate(unittest.TestCase):
def test_site_app_template_escapes_user_controlled_fields(self):
import re
- from posthog.cdp.templates._siteapps.template_early_access_features import template
+ from products.cdp.backend.templates._siteapps.template_early_access_features import template
code = template.code
@@ -58,7 +58,7 @@ class TestEarlyAccessFeatureSiteAppTemplate(unittest.TestCase):
unlike raw encodeURI which would allow javascript: URLs through."""
import re
- from posthog.cdp.templates._siteapps.template_early_access_features import template
+ from products.cdp.backend.templates._siteapps.template_early_access_features import template
code = template.code
diff --git a/products/logs/backend/test/test_alerts_api.py b/products/logs/backend/test/test_alerts_api.py
index a2cf6c4386fa..74279cae2ce6 100644
--- a/products/logs/backend/test/test_alerts_api.py
+++ b/products/logs/backend/test/test_alerts_api.py
@@ -11,13 +11,13 @@ from parameterized import parameterized
from rest_framework import status
from rest_framework.test import APIClient
-from posthog.cdp.templates.fixtures import template_pagerduty, template_slack
from posthog.clickhouse.client import sync_execute
from posthog.models.team.team import Team
from posthog.models.user import User
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.templates.fixtures import template_pagerduty, template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.cdp.backend.templates.microsoft_teams.template_microsoft_teams import template as template_microsoft_teams
from products.logs.backend.alert_check_query import AlertCheckQuery, BucketedCount
diff --git a/products/replay_vision/backend/tests/test_vision_alerts_api.py b/products/replay_vision/backend/tests/test_vision_alerts_api.py
index 927594c7005d..2f561a1e3696 100644
--- a/products/replay_vision/backend/tests/test_vision_alerts_api.py
+++ b/products/replay_vision/backend/tests/test_vision_alerts_api.py
@@ -10,7 +10,6 @@ from django.db import IntegrityError, transaction
from parameterized import parameterized
-from posthog.cdp.templates.fixtures import template_slack
from posthog.constants import AvailableFeature
from posthog.models import Organization, PersonalAPIKey, Team, User
from posthog.models.activity_logging.activity_log import ActivityLog
@@ -18,6 +17,7 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from products.access_control.backend.models.access_control import AccessControl
from products.cdp.backend.models.hog_functions.hog_function import HogFunction, HogFunctionTemplate
+from products.cdp.backend.templates.fixtures import template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.replay_vision.backend.models.replay_scanner import ReplayScanner, ScannerModel, ScannerType
from products.replay_vision.backend.models.vision_alert import (
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/attentive/tests/test_attentive_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/attentive/tests/test_attentive_webhook_template.py
index 315a9d9bd2ef..f6eee61cabb8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/attentive/tests/test_attentive_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/attentive/tests/test_attentive_webhook_template.py
@@ -2,8 +2,7 @@ import hmac
import json
import hashlib
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.attentive.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/calendly/tests/test_calendly_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/calendly/tests/test_calendly_webhook_template.py
index fd99f906b382..814bcf0ef31a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/calendly/tests/test_calendly_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/calendly/tests/test_calendly_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.calendly.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/test/test_default_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/test/test_default_webhook_template.py
index 2ba9c6896470..37da3d44c2d8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/test/test_default_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/test/test_default_webhook_template.py
@@ -1,7 +1,6 @@
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.common.default_webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/customer_io/tests/test_customer_io_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/customer_io/tests/test_customer_io_webhook_template.py
index 782d8e89a925..81e3e640858e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/customer_io/tests/test_customer_io_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/customer_io/tests/test_customer_io_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.customer_io.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/fourthwall/tests/test_fourthwall_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/fourthwall/tests/test_fourthwall_webhook_template.py
index fb36f951df2f..1749268cd1e9 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/fourthwall/tests/test_fourthwall_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/fourthwall/tests/test_fourthwall_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.fourthwall.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/gitea/tests/test_gitea_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/gitea/tests/test_gitea_webhook_template.py
index f80e2314e30b..523f5e40a782 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/gitea/tests/test_gitea_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/gitea/tests/test_gitea_webhook_template.py
@@ -3,8 +3,7 @@ import json
import hashlib
from typing import Any
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.gitea.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_webhook_template.py
index db7ff3a0658a..4359461f52e2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_webhook_template.py
@@ -3,8 +3,7 @@ from typing import Any
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.github.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun_webhook_template.py
index d204b8e7055f..63edd56081da 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mailgun/tests/test_mailgun_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.mailgun.settings import (
WEBHOOK_EVENT_NAMES,
WEBHOOK_RESOURCE_KEY,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mailjet/tests/test_mailjet_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mailjet/tests/test_mailjet_webhook_template.py
index af1aac815e3c..c1839294b330 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mailjet/tests/test_mailjet_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mailjet/tests/test_mailjet_webhook_template.py
@@ -4,8 +4,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.mailjet.settings import MAILJET_WEBHOOK_EVENTS
from products.warehouse_sources.backend.temporal.data_imports.sources.mailjet.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/pipedrive/tests/test_pipedrive_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/pipedrive/tests/test_pipedrive_webhook_template.py
index df1e59aecb07..c3926eb9d618 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/pipedrive/tests/test_pipedrive_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/pipedrive/tests/test_pipedrive_webhook_template.py
@@ -4,8 +4,7 @@ from typing import Any
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.pipedrive.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postmark/tests/test_postmark_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postmark/tests/test_postmark_webhook_template.py
index 8f4d3449709d..f67a6583fac0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postmark/tests/test_postmark_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postmark/tests/test_postmark_webhook_template.py
@@ -2,8 +2,7 @@ import json
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.postmark.settings import WEBHOOK_SECRET_HEADER
from products.warehouse_sources.backend.temporal.data_imports.sources.postmark.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/slack/tests/test_slack_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/slack/tests/test_slack_webhook_template.py
index be94748ea16e..3fb5b0c89d69 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/slack/tests/test_slack_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/slack/tests/test_slack_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.slack.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/sparkpost/tests/test_sparkpost_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/sparkpost/tests/test_sparkpost_webhook_template.py
index 36f460d43858..493fe7a8d8bc 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/sparkpost/tests/test_sparkpost_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/sparkpost/tests/test_sparkpost_webhook_template.py
@@ -3,8 +3,7 @@ import base64
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.sparkpost.settings import WEBHOOK_BATCH_KEY
from products.warehouse_sources.backend.temporal.data_imports.sources.sparkpost.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_webhook_template.py
index 434190d9c60d..4a54951fd67c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.stripe.webhook_template import template
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/webflow/tests/test_webflow_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/webflow/tests/test_webflow_webhook_template.py
index bbfade17eda7..f02e6aeb7d46 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/webflow/tests/test_webflow_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/webflow/tests/test_webflow_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.webflow.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/woocommerce/tests/test_woocommerce_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/woocommerce/tests/test_woocommerce_webhook_template.py
index 796c51d58f6f..2527e4689bd0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/woocommerce/tests/test_woocommerce_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/woocommerce/tests/test_woocommerce_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.woocommerce.webhook_template import template
SOURCE_ID = "source_test_123"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/workos/tests/test_workos_webhook_template.py b/products/warehouse_sources/backend/temporal/data_imports/sources/workos/tests/test_workos_webhook_template.py
index 80d3bc6e1471..f33eaf652c6f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/workos/tests/test_workos_webhook_template.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/workos/tests/test_workos_webhook_template.py
@@ -5,8 +5,7 @@ import hashlib
from parameterized import parameterized
-from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest
-
+from products.cdp.backend.templates.helpers import BaseHogFunctionTemplateTest
from products.warehouse_sources.backend.temporal.data_imports.sources.workos.settings import WEBHOOK_EVENT_TO_SCHEMA
from products.warehouse_sources.backend.temporal.data_imports.sources.workos.webhook_template import template
diff --git a/products/workflows/backend/test/test_refresh_hog_flows.py b/products/workflows/backend/test/test_refresh_hog_flows.py
index 2d0d09ad370f..5ff9ac1cfcf2 100644
--- a/products/workflows/backend/test/test_refresh_hog_flows.py
+++ b/products/workflows/backend/test/test_refresh_hog_flows.py
@@ -9,11 +9,11 @@ from django.core.management import call_command
from parameterized import parameterized
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.models import Team
from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES
from products.cdp.backend.filters import RUNTIME_CONTRACT
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.workflows.backend.models.hog_flow.hog_flow import HogFlow
diff --git a/products/workflows/backend/tests/api/test_hog_flow.py b/products/workflows/backend/tests/api/test_hog_flow.py
index d7efb9f4e5cb..e835eee87fbc 100644
--- a/products/workflows/backend/tests/api/test_hog_flow.py
+++ b/products/workflows/backend/tests/api/test_hog_flow.py
@@ -17,8 +17,6 @@ from django.utils import timezone
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.templates.fixtures import template_slack
-from posthog.cdp.templates.hog_function_template import sync_template_to_db
from posthog.constants import AvailableFeature
from posthog.event_usage import EventSource
from posthog.models import Organization, OrganizationMembership, Team, User
@@ -34,6 +32,8 @@ from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_
from products.cdp.backend.filters import RUNTIME_CONTRACT
from products.cdp.backend.flag_gated_templates import gated_template_enabled
from products.cdp.backend.models.hog_functions.hog_function import HogFunction
+from products.cdp.backend.templates.fixtures import template_slack
+from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.cohorts.backend.models.cohort import Cohort
from products.skills.backend.models.skills import LLMSkill
from products.tasks.backend.facade.contracts import WorkflowLastRunDTO
diff --git a/products/workflows/backend/tests/api/test_hog_flow_template.py b/products/workflows/backend/tests/api/test_hog_flow_template.py
index 960996118e9d..05bda0bad20f 100644
--- a/products/workflows/backend/tests/api/test_hog_flow_template.py
+++ b/products/workflows/backend/tests/api/test_hog_flow_template.py
@@ -5,11 +5,11 @@ from posthog.test.base import APIBaseTest
from parameterized import parameterized
from rest_framework import status
-from posthog.cdp.templates.fixtures import template_slack
from posthog.models import Organization, Team, User
from products.cdp.backend.api.test.test_hog_function_templates import MOCK_NODE_TEMPLATES
from products.cdp.backend.models.hog_function_template import HogFunctionTemplate
+from products.cdp.backend.templates.fixtures import template_slack
from products.cdp.backend.templates.hog_function_template import sync_template_to_db
from products.workflows.backend.models.hog_flow.hog_flow_template import HogFlowTemplate
from products.workflows.backend.templates import clear_template_cache, load_global_templates