From b562836685e5ef9f7498b8aac67542fe4dbb73dc Mon Sep 17 00:00:00 2001 From: Marcus Hof <13001502+MarconLP@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:35:41 +0100 Subject: [PATCH] feat(cdp): add brevo destination (#26195) Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- frontend/public/services/brevo.png | Bin 0 -> 24286 bytes posthog/cdp/templates/__init__.py | 2 + posthog/cdp/templates/brevo/template_brevo.py | 81 ++++++++++++++++++ .../templates/brevo/test_template_brevo.py | 46 ++++++++++ 4 files changed, 129 insertions(+) create mode 100644 frontend/public/services/brevo.png create mode 100644 posthog/cdp/templates/brevo/template_brevo.py create mode 100644 posthog/cdp/templates/brevo/test_template_brevo.py diff --git a/frontend/public/services/brevo.png b/frontend/public/services/brevo.png new file mode 100644 index 0000000000000000000000000000000000000000..65dfdbac8030abc89fa07c13c877cdfb654b3259 GIT binary patch literal 24286 zcmeHvc|26__xQDBiAXAKB9s)yzJ(Fl5(=qQCdOE@jAq8ZOuH7@C9;)Dr4mB6rc%ki zg(y^ZvdvhUF=l?xjPh3R`g}j%cc0JqpI>)gbMLd9d!F;0=bZCA&$;(p`dj+PCB^!_ zE{+gnY6@+EAcza%WLXBWffNh)K`d*aMa(n=*|V&jPakF3{1t{3z{o@33~c~^42uFY zy&R;YLtG&CulL>t*Ei5&>Tw8?T>9<0-2rWn65Z{L#-Xv!XirfEWm!4V&8Bup7Y{~> z6r>=hpr|1)uc4qW3eNH%tqkz6rLxSmO{YUpD(km4Sfo?g{z?Nl#=*hD_LWYKg?(WW z`>QW3TNd_(m1Q1>0_!|(-jj3aAR}-ET$#Jl-_nO6US=;4dZrL7eFWlT<{*dT3^@8b z=rqL3#l^+V#mmjjE5NguM_>g%FE9U!Rf2*m1O-6@ z8^prOzKDa9i+eE-5P*mxB|r2rfIhGp`Lw(qeM z6gzf8fn#~(wJcq6i4_*l>=l(TC+qb%H%3{GeH=$(l~-QRKDB8_w3UPY^E8}_P{Z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@OvWnA2R%Lar%I%U-(}+!{4oEY+>G!@X^#eJ%lYbep?L+ z^N7vyuD1@ho5(!%Th_es{Na_&oU1jMK}`s-^A_6ZiJ{xcoJt zA74BQ-mX|5LWjg3;Ct__hek1k?w&!y8#|ILu!l4fVb;iBgc?==-mA(Q;{-Ocys`;@ zyR;WP2hyAE!&4$A;ACMe9a2Vq-~-R)qT}w;p*;OUbWPw@Z;NnS^gKbEi^ORj9CK_g(*~pI z+A~qQ>Wd(a+(&7l_KNh?JiN3#*d@On=}$bY@v1}R+L+%mLlHf@Ro91<*SCA;?a>nr zpR|V?ZT$4ao?1qtLs!9^a=y6l-jIvvr@F%(rV>^|=DYGC?a(Xd)+KRd&yfAXxAf1D{o+aV{{q>= Ntq= 400) { + throw Error(f'Error from api.brevo.com (status {res.status}): {res.body}') +} +""".strip(), + inputs_schema=[ + { + "key": "apiKey", + "type": "string", + "label": "Brevo API Key", + "description": "Check out this page on how to get your API key: https://help.brevo.com/hc/en-us/articles/209467485-Create-and-manage-your-API-keys", + "secret": True, + "required": True, + }, + { + "key": "email", + "type": "string", + "label": "Email of the user", + "description": "Where to find the email for the contact to be created. You can use the filters section to filter out unwanted emails or internal users.", + "default": "{person.properties.email}", + "secret": False, + "required": True, + }, + { + "key": "attributes", + "type": "dictionary", + "label": "Attributes", + "description": "For information on potential attributes, refer to the following page: https://help.brevo.com/hc/en-us/articles/10617359589906-Create-and-manage-contact-attributes", + "default": { + "EMAIL": "{person.properties.email}", + "FIRSTNAME": "{person.properties.firstname}", + "LASTNAME": "{person.properties.lastname}", + }, + "secret": False, + "required": True, + }, + ], + filters={ + "events": [ + {"id": "$identify", "name": "$identify", "type": "events", "order": 0}, + {"id": "$set", "name": "$set", "type": "events", "order": 0}, + ], + "actions": [], + "filter_test_accounts": True, + }, +) diff --git a/posthog/cdp/templates/brevo/test_template_brevo.py b/posthog/cdp/templates/brevo/test_template_brevo.py new file mode 100644 index 0000000000000..839dabbc5a3b0 --- /dev/null +++ b/posthog/cdp/templates/brevo/test_template_brevo.py @@ -0,0 +1,46 @@ +from inline_snapshot import snapshot +from posthog.cdp.templates.helpers import BaseHogFunctionTemplateTest +from posthog.cdp.templates.brevo.template_brevo import ( + template as template_brevo, +) + + +def create_inputs(**kwargs): + inputs = { + "apiKey": "apikey12345", + "email": "max@posthog.com", + "attributes": {"EMAIL": "max@posthog.com", "FIRSTNAME": "Max"}, + } + inputs.update(kwargs) + + return inputs + + +class TestTemplateBrevo(BaseHogFunctionTemplateTest): + template = template_brevo + + def test_function_works(self): + self.run_function(inputs=create_inputs()) + assert self.get_mock_fetch_calls()[0] == snapshot( + ( + "https://api.brevo.com/v3/contacts", + { + "method": "POST", + "headers": { + "api-key": "apikey12345", + "Content-Type": "application/json", + }, + "body": { + "email": "max@posthog.com", + "updateEnabled": True, + "attributes": {"EMAIL": "max@posthog.com", "FIRSTNAME": "Max"}, + }, + }, + ) + ) + + def test_function_requires_identifier(self): + self.run_function(inputs=create_inputs(email="")) + + assert not self.get_mock_fetch_calls() + assert self.get_mock_print_calls() == snapshot([("No email set. Skipping...",)])