Webhooks

To integrate via webhooks go to the form's Integration tab, enable the webhook switch button and choose a URL where the webhook will be sent. Once you do that, Form-Data will send an HTTP POST request to the provided URL, and send the submitted data as JSON in the body.​

Here's an example of how the POST data looks like:

Note how the data itself contains the fields of your form

Verifying Webhook Signature

If you'd like to verify that the request has been made from Form-Data and not from anyone else you should read 
x-signature header. It will be a signed JWT that contains the form's submit key (the unique string at the end of the form's action URL).

To verify the signature use the form's secret. It can be found in the integrations tab:

For example, if you're using a node server, you can use jsonwebtoken npm package with this code:

import jwt from 'jsonwebtoken';

//secret can be found in the Integrations tab of your Admin Console
const SECRET = "FORM-SECRET";

function validateSignature(request) {
  let token = request.headers["x-signature"];
  let decoded;
  try {
    decoded = jwt.verify(token, SECRET);
  } catch (error) {
    //SIGNATURE IS NOT VALID
    return false;
  }
  //If you have multiple forms submitting to the same webhook URL, you can use decoded.formid to tell which one was submitted. 
  //The ID is the last part of your form's Action Url. It can be found in the Edit tab
  return true;
}

 


Did this help answer your question?

thumbs up
thumbs down

Thanks for the feedback! 🙏🏽


Help by drift