How to Set Up a Webhook with Jotform

May 13, 2022

What is a Webhook?

A webhook is a technique used to send HTTP POST notifications to a URL. They can be used to connect apps together or just send data.

Send Instant Submission Notifications with Webhooks

To add a webhook and send submissions to your endpoint…

  1. Go to the Settings tab in the Form Builder.
  2. Click Integrations on the left.
  3. Search for “webhooks”.
  4. Select WebHooks.
  5. Enter the endpoint URL in the Add WebHook field.
  6. Finally, click the Complete Integration button.

Here’s an example PHP script that you may want to try on Webhook. This is a simple mailer script that will send the form submissions data to your email through Webhook.

// convert json data to php
$result = $_REQUEST["rawRequest"];
$obj = json_decode($result, true);
// Change with your emails
$emailfrom = ""; // Sender or From Email
$emailto = ""; // Recipient, you can predefine or use a field value e.g. $obj['q4_email']
$subject = "You've got a new submission"; // Email Subject Title
// Do not edit
$id = $_POST["submissionID"]; // Get submission ID
$submissionURL = "" . $id; // Construct submission URL
$headers = "From: " . $emailfrom . "\r\n";
$headers .= "Reply-To: " . $emailfrom . "\r\n"; // Optional
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
// New method, get data from the submissions page
$html = new DOMDocument();
$body = $html->getElementsByTagName("body")->item(0);
// get html code after the body tag
foreach ($body->childNodes as $child) {
$html->appendChild($html->importNode($child, true));
// make the table responsive so it appears nicely on email
$body = $html->getElementsByTagName("table");
foreach ($body as $width) {
$width->setAttribute("width", "100%");
$body = $html->saveHTML();
// Send email
@mail($emailto, $subject, $body, $headers);

Make sure to replace the field names and emails with the ones from your form, you can also add fields if you prefer.

Check out the Webhook PHP Script Examples guide to find more useful scripts.

If you have questions, post them below.

Was this guide helpful?
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum:

Contact Jotform Support:

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.