: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(cdp): skip the Attio upsert when the person has no email (#80926)
Daniel Marchukb510a0563375
diff --git a/posthog/cdp/templates/attio/template_attio.py b/posthog/cdp/templates/attio/template_attio.pyindex 0b6a55461205..aeac7da6a1e3 100644--- a/posthog/cdp/templates/attio/template_attio.py+++ b/posthog/cdp/templates/attio/template_attio.py@@ -11,6 +11,11 @@ template: HogFunctionTemplateDC = HogFunctionTemplateDC(category=["Advertisement"],code_language="hog",code="""+if (empty(inputs.email)) {+ print('No email set. Skipping...')+ return+}+let body := {'data': {'values': {diff --git a/posthog/cdp/templates/attio/test_template_attio.py b/posthog/cdp/templates/attio/test_template_attio.pyindex 6dec03e887bd..66414be777b1 100644--- a/posthog/cdp/templates/attio/test_template_attio.py+++ b/posthog/cdp/templates/attio/test_template_attio.py@@ -39,6 +39,12 @@ class TestTemplateAttio(BaseHogFunctionTemplateTest):},)+ def test_function_requires_email(self):+ self.run_function(inputs=create_inputs(email=""))++ assert not self.get_mock_fetch_calls()+ assert self.get_mock_print_calls() == [("No email set. Skipping...",)]+def test_ignores_empty_values(self):self.mock_fetch_response = lambda *args: {"status": 200, "body": {"ok": True}} # type: ignoreself.run_function(inputs=create_inputs(personAttributes={"name": "Max", "job_title": ""}))