From 6a0d17becd41cc57e8ee84ae0346680ae09475c8 Mon Sep 17 00:00:00 2001 From: Norbert Kwizera Date: Fri, 15 Mar 2024 14:19:40 +0200 Subject: [PATCH] Add url param type for buttons with URLs --- temba/utils/whatsapp/tasks.py | 2 +- temba/utils/whatsapp/tests.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/temba/utils/whatsapp/tasks.py b/temba/utils/whatsapp/tasks.py index e79423b2896..51f905d6828 100644 --- a/temba/utils/whatsapp/tasks.py +++ b/temba/utils/whatsapp/tasks.py @@ -139,7 +139,7 @@ def _extract_template_params(components): display = "" if button["type"].lower() == "url": for match in VARIABLE_RE.findall(button.get("url", "")): - comp_params.append({"type": "text"}) + comp_params.append({"type": "url"}) content = button.get("url", "") display = button.get("text", "") if comp_params: diff --git a/temba/utils/whatsapp/tests.py b/temba/utils/whatsapp/tests.py index b61323a0435..5b164071f11 100644 --- a/temba/utils/whatsapp/tests.py +++ b/temba/utils/whatsapp/tests.py @@ -281,7 +281,7 @@ def test_update_local_templates_whatsapp(self): "button.3": { "content": r"https:\/\/example.com\/?wa_customer={{1}}", "display": "Check website", - "params": [{"type": "text"}], + "params": [{"type": "url"}], }, "button.4": {"content": r"https:\/\/example.com\/help", "display": "Check website", "params": []}, }, @@ -291,7 +291,7 @@ def test_update_local_templates_whatsapp(self): { "header": [{"type": "image"}], "body": [{"type": "text"}, {"type": "text"}], - "button.3": [{"type": "text"}], + "button.3": [{"type": "url"}], }, ct.params, )