mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							63eae63a07
						
					
				
				
					commit
					3d7462a0e7
				
			
							
								
								
									
										
											BIN
										
									
								
								static/images/integrations/bot_avatars/jotform.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/images/integrations/bot_avatars/jotform.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 4.6 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								static/images/integrations/jotform/001.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								static/images/integrations/jotform/001.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 42 KiB  | 
							
								
								
									
										1
									
								
								static/images/integrations/logos/jotform.svg
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								static/images/integrations/logos/jotform.svg
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"><defs><linearGradient id="linear-gradient" x1="109.36" y1="201.96" x2="223.31" y2="201.96" gradientTransform="rotate(6.74 414.38 250.811)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f1ceba"/><stop offset="1" stop-color="#b8846f"/></linearGradient><clipPath id="clip-path" transform="translate(-100 458)"><path id="SVGID" class="cls-1" d="M500-258c0 110.45-89.55 200-200 200s-200-89.53-200-200 89.54-200 200-200 200 89.55 200 200z"/></clipPath><style>.cls-1{fill:none}</style></defs><g style="isolation:isolate"><g id="Layer_1" data-name="Layer 1"><path d="M500-258c0 110.45-89.55 200-200 200s-200-89.53-200-200 89.54-200 200-200 200 89.55 200 200z" transform="translate(-100 458)" fill="#fff"/><g clip-path="url(#clip-path)"><path d="M463.76-225l24.3-101.16A200.63 200.63 0 00385.07-439l-36.52 197-136.07 110.48z" transform="translate(-100 458)" opacity=".05"/><path d="M300-458a200 200 0 00-53.91 7.41l-17.92 66.18 37.3 5.29 38.46 13.21 34.74 17.42 27.67-98.18A199.57 199.57 0 00300-458z" transform="translate(-100 458)" fill="#f38632"/><path fill="#4e4e4e" d="M149.95 264.59l-37.47 61.89 4.47-72.65 10.98.44 13.4 3.71 8.62 6.61z"/><path fill="url(#linear-gradient)" d="M149.95 264.59l-8.62-6.61-13.4-3.71-10.98-.44 11.23-180.24 37.3 5.29 38.46 13.21 34.74 17.41-88.73 155.09z"/><path d="M246.1-450.59l-17.92 66.18 37.3 5.29 22.69-78.5a199.44 199.44 0 00-42.07 7.03z" transform="translate(-100 458)" fill="#f6a259"/><path d="M366.35-446.68a198.51 198.51 0 00-35.51-8.95l-26.9 89.72-91.46 234.39L250-193.41l88.68-155.09z" transform="translate(-100 458)" style="mix-blend-mode:multiply" fill="#1a1a1a" opacity=".2"/><path opacity=".15" fill="#fff" d="M112.48 325.54l53-246.67-37.3-5.28-15.7 251.95z"/><path class="cls-1" d="M500-258c0 110.45-89.55 200-200 200s-200-89.53-200-200 89.54-200 200-200 200 89.55 200 200z" transform="translate(-100 458)"/></g></g></g></svg>
 | 
			
		||||
| 
		 After Width: | Height: | Size: 1.9 KiB  | 
@@ -397,6 +397,7 @@ WEBHOOK_INTEGRATIONS: List[WebhookIntegration] = [
 | 
			
		||||
    WebhookIntegration("insping", ["monitoring"], display_name="Insping"),
 | 
			
		||||
    WebhookIntegration("intercom", ["customer-support"], display_name="Intercom"),
 | 
			
		||||
    WebhookIntegration("jira", ["project-management"], display_name="JIRA"),
 | 
			
		||||
    WebhookIntegration("jotform", ["misc"], display_name="Jotform"),
 | 
			
		||||
    WebhookIntegration("librato", ["monitoring"]),
 | 
			
		||||
    WebhookIntegration("mention", ["marketing"], display_name="Mention"),
 | 
			
		||||
    WebhookIntegration("netlify", ["continuous-integration", "deployment"], display_name="Netlify"),
 | 
			
		||||
@@ -689,6 +690,7 @@ DOC_SCREENSHOT_CONFIG: Dict[str, List[ScreenshotConfig]] = {
 | 
			
		||||
    "insping": [ScreenshotConfig("website_state_available.json")],
 | 
			
		||||
    "intercom": [ScreenshotConfig("conversation_admin_replied.json")],
 | 
			
		||||
    "jira": [ScreenshotConfig("created_v1.json")],
 | 
			
		||||
    "jotform": [ScreenshotConfig("response.json")],
 | 
			
		||||
    "librato": [ScreenshotConfig("three_conditions_alert.json", payload_as_query_param=True)],
 | 
			
		||||
    "mention": [ScreenshotConfig("webfeeds.json")],
 | 
			
		||||
    "netlify": [ScreenshotConfig("deploy_building.json")],
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								zerver/webhooks/jotform/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								zerver/webhooks/jotform/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										17
									
								
								zerver/webhooks/jotform/doc.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								zerver/webhooks/jotform/doc.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
Get Zulip notifications for your JotForm responses!
 | 
			
		||||
 | 
			
		||||
1. {!create-stream.md!}
 | 
			
		||||
 | 
			
		||||
1. {!create-bot-construct-url-indented.md!}
 | 
			
		||||
   By default, the integration will use the form's title as the topic.
 | 
			
		||||
 | 
			
		||||
1. In Jotform, go to **Form Builder**, and click on **Settings** tab.
 | 
			
		||||
 | 
			
		||||
1. Click on **INTEGRATIONS**, search for **WebHooks** and select it.
 | 
			
		||||
 | 
			
		||||
1. Add the above constructed **url** to the field, and click the
 | 
			
		||||
   **COMPLETE INTEGRATION** button.
 | 
			
		||||
 | 
			
		||||
{!congrats.md!}
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
							
								
								
									
										11
									
								
								zerver/webhooks/jotform/fixtures/response.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								zerver/webhooks/jotform/fixtures/response.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										23
									
								
								zerver/webhooks/jotform/tests.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								zerver/webhooks/jotform/tests.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
from zerver.lib.test_classes import WebhookTestCase
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class JotFormHookTests(WebhookTestCase):
 | 
			
		||||
    STREAM_NAME = "test"
 | 
			
		||||
    URL_TEMPLATE = "/api/v1/external/jotform?stream={stream}&api_key={api_key}"
 | 
			
		||||
    FIXTURE_DIR_NAME = "jotform"
 | 
			
		||||
 | 
			
		||||
    def test_response(self) -> None:
 | 
			
		||||
        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()
 | 
			
		||||
 | 
			
		||||
        self.check_webhook(
 | 
			
		||||
            "response",
 | 
			
		||||
            expected_title,
 | 
			
		||||
            expected_message,
 | 
			
		||||
            content_type="application/x-www-form-urlencoded",
 | 
			
		||||
        )
 | 
			
		||||
							
								
								
									
										31
									
								
								zerver/webhooks/jotform/view.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								zerver/webhooks/jotform/view.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
# Webhooks for external integrations.
 | 
			
		||||
from typing import Any, Dict
 | 
			
		||||
 | 
			
		||||
from django.http import HttpRequest, HttpResponse
 | 
			
		||||
 | 
			
		||||
from zerver.decorator import webhook_view
 | 
			
		||||
from zerver.lib.request import REQ, has_request_variables
 | 
			
		||||
from zerver.lib.response import json_success
 | 
			
		||||
from zerver.lib.webhooks.common import check_send_webhook_message
 | 
			
		||||
from zerver.models import UserProfile
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@webhook_view("Jotform")
 | 
			
		||||
@has_request_variables
 | 
			
		||||
def api_jotform_webhook(
 | 
			
		||||
    request: HttpRequest,
 | 
			
		||||
    user_profile: UserProfile,
 | 
			
		||||
    payload: Dict[str, Any] = REQ(argument_type="body"),
 | 
			
		||||
) -> HttpResponse:
 | 
			
		||||
    topic = payload["formTitle"]
 | 
			
		||||
    submission_id = payload["submissionID"]
 | 
			
		||||
    fields_dict = list(payload["pretty"].split(", "))
 | 
			
		||||
 | 
			
		||||
    form_response = f"A new submission (ID {submission_id}) was received:\n"
 | 
			
		||||
    for field in fields_dict:
 | 
			
		||||
        form_response += f"* {field}\n"
 | 
			
		||||
 | 
			
		||||
    message = form_response.strip()
 | 
			
		||||
 | 
			
		||||
    check_send_webhook_message(request, user_profile, topic, message)
 | 
			
		||||
    return json_success()
 | 
			
		||||
		Reference in New Issue
	
	Block a user