From 66e5f3bf70d0edb4abd8a3685bb5ac96c683bf03 Mon Sep 17 00:00:00 2001 From: dvirlabs <114520947+dvirlabs@users.noreply.github.com> Date: Thu, 14 May 2026 15:50:08 +0300 Subject: [PATCH] Fix template --- backend/whatsapp_templates.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/whatsapp_templates.py b/backend/whatsapp_templates.py index 16d04e5..4ec5cfa 100644 --- a/backend/whatsapp_templates.py +++ b/backend/whatsapp_templates.py @@ -45,6 +45,13 @@ def load_custom_templates(db: Session) -> Dict[str, Dict[str, Any]]: templates = db.query(WhatsAppTemplate).all() result = {} for t in templates: + # Determine button_param_key: + # - If button_url contains {{1}}, default to "event_id" + # - Otherwise leave empty (static URL buttons don't need params) + button_param_key = "" + if t.button_url and "{{1}}" in t.button_url: + button_param_key = "event_id" + result[t.template_key] = { "meta_name": t.meta_name, "language_code": t.language_code, @@ -59,7 +66,7 @@ def load_custom_templates(db: Session) -> Dict[str, Dict[str, Any]]: "button_type": t.button_type, "button_text": t.button_text, "button_url": t.button_url, - "button_param_key": t.button_url, # backward compat + "button_param_key": button_param_key, # Derived from URL pattern "fallbacks": json.loads(t.fallbacks), "guest_name_key": "", }