From df8970f1016205e57d1243a2fc7f47ae6d7aa90e Mon Sep 17 00:00:00 2001 From: dvirlabs <114520947+dvirlabs@users.noreply.github.com> Date: Wed, 13 May 2026 17:50:55 +0300 Subject: [PATCH] Add hina_invitation to built-in templates with NO body parameters (static body) and fix test endpoint --- backend/main.py | 11 +++++------ backend/whatsapp_templates.py | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/backend/main.py b/backend/main.py index 78a3852..e01fe1f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -81,9 +81,9 @@ def _fix_template_parameters(): if template: # Expected correct parameters for hina_invitation - # Body {{1}} = contact_name (guest's name) - # Button {{1}} = event_id (sent as separate button parameter) - expected_params = ["contact_name"] + # hina_invitation has NO body parameters (body is static in Meta) + # Only has button parameter: event_id + expected_params = [] try: current_params = json.loads(template.body_params) @@ -2001,13 +2001,12 @@ async def test_whatsapp_send( service = get_whatsapp_service(db) - # Send with minimal parameters - just for testing + # hina_invitation template has no body parameters - only button parameter params = { - "contact_name": "Test", "event_id": "test-event-123" } - # Use hina_invitation template (only requires contact_name and event_id) + # Use hina_invitation template (static body, dynamic button URL) template_key = "hina_invitation" result = await service.send_by_template_key( diff --git a/backend/whatsapp_templates.py b/backend/whatsapp_templates.py index 4802aac..8f757c4 100644 --- a/backend/whatsapp_templates.py +++ b/backend/whatsapp_templates.py @@ -240,6 +240,26 @@ TEMPLATES: Dict[str, Dict[str, Any]] = { "guest_link": "https://invy.dvirlabs.com/guest", }, }, + + # ── hina_invitation ──────────────────────────────────────────────────────── + # Special event template with static body text and dynamic button URL + # No body parameters - body text is defined in Meta template + # Button {{1}} = event_id (dynamic URL parameter) + "hina_invitation": { + "meta_name": "hina_invitation", + "language_code": "he", + "friendly_name": "הזמנה לחינה", + "description": "הזמנה לאירוע חינה עם קישור דינמי", + "header_params": [], + "body_params": [], + "button_type": "URL", + "button_text": "הצבע על הזמנה", + "button_url": "https://invy.dvirlabs.com/guest/{{1}}", + "button_param_key": "event_id", + "fallbacks": { + "event_id": "event-id", + }, + }, }