integrations: Improve message formatting for Jotform.

This commit is contained in:
Niloth P 2024-11-19 13:40:49 +05:30
parent 31fb2fbe7c
commit 87bdb41214
2 changed files with 6 additions and 5 deletions

View File

@ -10,10 +10,9 @@ class JotformHookTests(WebhookTestCase):
expected_title = "Form"
expected_message = """
A new submission (ID 4791133489169827307) was received:
* Name:Gaurav Pandey
* Address:Lampgarden-street wolfsquare Bengaluru Karnataka 165578
* Signature:uploads/gauravguitarrocks/202944822449057/4791133489169827307/4791133489169827307_signature_4.png
""".strip()
* *Name*: Gaurav Pandey
* *Address*: Lampgarden-street wolfsquare Bengaluru Karnataka 165578
* *Signature*: uploads/gauravguitarrocks/202944822449057/4791133489169827307/4791133489169827307_signature_4.png""".strip()
self.check_webhook(
"response",

View File

@ -24,7 +24,9 @@ def api_jotform_webhook(
form_response = f"A new submission (ID {submission_id}) was received:\n"
for field in fields:
form_response += f"* {field}\n"
label, value = field.split(":", 1)
separator = " " if label.endswith("?") else ": "
form_response += f"* *{label}*{separator}{value}\n"
message = form_response.strip()