Webhooks

What are Webhooks?

A webhook is an event or a notification that's being sent from one location to the other when an action occurs. For QuestionScout, the event that will trigger the webhook is a submission in one of our forms. When a submission is stored, a notification containing the response data is being sent straight to your chosen destination - the webhook URL which you configure in the form settings.

Webhook notifications are sent via HTTP POST request, and the request body is in JSON format.

This is an example of what the request body in JSON looks like:

{
  formId: '5d865f7e6c52467a966e1986',
  eventType: 'newSubmission',
  submittedAt: '2019-10-01T17:48:45.449Z',
  completionTime: 142,
  number: 19,
  ip: '0:0:0:0',
  submissionId: '5d93917d8c26ff6060bf80eb',
  formName: 'Webhook Example',
  "urlParams": [
    {
      "key": "userid",
      "value": "12345"
    },
    {
      "key": "type",
      "value": "web"
    }
  ],
  fields:
    [{
      name: 'Long Answer',
      id: '5d865fbc6c52467a966e198a',
      type: 'longText',
      value: 'Lorem ipsum dol'
    },
    {
      name: 'Number',
      id: '5d865fc16c52467a966e198b',
      type: 'shortText',
      value: 1
    },
    {
      name: 'Short Answer',
      id: '5d93700f55a8ca59d5dbc21d',
      type: 'shortText',
      value: 'Lorem ipsum'
    },
    {
      name: 'Number',
      id: '5d93701455a8ca59d5dbc21e',
      type: 'shortText',
      value: 2
    }]
}

How to set up Webhooks

To set up Webhooks on your form, you need to open the form you would like to enable Webhooks on, and go to the Settings tab. 

For this example, we use Webhook.site to see if the Webhook is coming through correctly.

On the form settings tab, you will find an area to put in your Webhooks at the bottom of the page.

Clicking "Add a Webhook" will open a model where you can enter your endpoint.

When you've entered the endpoint for the Webhook, clicking "Add Webhook" will show you the the POST + Endpoint on the form settings tab.

That's all to it when adding Webhooks to your QuestionScout form.

Still need help? Contact Us Contact Us