Webhooks

Introduction

Webhooks enable Discover to send real-time notifications and data to another application when specific survey events occur.  As respondents progress through a survey, Discover automatically sends event data to a URL you specify, allowing you to integrate with external systems, automate workflows, update databases, or trigger custom business processes. Contact your account manager to enable webhooks on your account. 

Adding a webhook

Discover UI showing the three buttons to click to add webhooks

Open Survey settings, open the Webhooks tab, and click Add webhook. Configure and test the webhook as described below. Webhooks save automatically, so you can leave the settings at any time without losing changes. 

Configure the webhook

On the General tab, configure the core settings including the request type (GET/POST), endpoint URL, authentication, and the survey event that triggers the webhook. 

Note: For security reasons, only survey owners can enter the Endpoint URL, and create or select a Secret. Collaborators cannot modify these settings. 

Add any variables (key-value pairs) you want to send when the webhook is triggered. Where you add them depends on how the receiving system expects to receive them: 

  • URL parameters tab: Variables sent as URL query parameters.
  • Body content tab: Variables included in the request body.
    • For more complex data structures, toggle on JSON editor mode to write custom JSON. To pipe in survey question and variable values in the JSON editor, use {{getValueForJSON(“QuestionName”)}} or {{getLabelForJSON("QuestionName")}} . These functions encode values so they dont break the JSON when piped in.  

Webhook Tabs

 

If you're unsure whether variables belong in the URL or request body, consult your IT team or the administrator of the receiving system.  

For authentication setup, see the webhook authentication section below. 

Test the webhook

We strongly recommend testing your webhook before launching your survey, and again after any configuration changes to ensure it’s working properly. 

To run a test, click Test, enter sample values for any configured URL parameters or body content properties, and click Send test. Review the response in the Response details panel. 

A few things to note: 

  • Values may only be 1,024 characters long for testing purposes.
  • Properties with a value of "null" are omitted from the request, including unseen question responses.
  • A 200 response code indicates the request was received successfully.
  • 400 and 500 response codes indicate an error. Verify your endpoint URL, authentication settings, and variable configuration before retrying. 

Webhook authentication

Webhook authentication verifies that requests from Discover are trusted by the receiving system. Two options are available: 

  • None: Sends the webhook without authentication. Use only if the receiving system doesn't require it.
  • Secret: Sends a secret credential with the request. The receiving system uses it to verify the request came from Discover. 

If you're unsure which type to use, consult the receiving system's documentation or your IT team. 

Using secret authentication

Before using secret authentication, create a secret in your Discover account settings. Then select Secret as the authentication type, choose the secret from the Secret value list, specify the Secret name (key), and choose the location — Request header, Request body or URL parameter. 

The secret name and location must match what the receiving system expects. Consult the receiving system's documentation if you're unsure. 

Webhook size guidelines

  • Keep the full webhook URL, including query parameters, under 2,000 characters. Longer URLs can be truncated or rejected.
  • Use URL parameters only for small identifying values like a respondent ID. Add larger data to the request body via the Body content tab.
  • Large payloads are more likely to time out or be rejected. Keep request body size below 15 MB. Most receiving systems enforce their own size limits — check with your IT team or the receiving system's documentation.
  • Only include variables the receiving system needs. Extra or duplicate data adds to the payload size without value. 

Security considerations

Inviting collaborators or sharing via the send a copy link also gives access to survey data, including webhook response data, which may be subject to privacy laws. Authentication secrets are cleared when a survey is duplicated or shared via send a copy for security purposes.

Scripting with webhook responses (advanced)

Successful webhook responses are saved to the respondent's data record as a string and can be accessed using script:  {{getValue(“webhookName”)}}. If you plan on displaying results of a webhook in a survey, you will likely need to utilize custom JavaScript and the JSON.parse() function. Examples can be found in the Discover community. 

Troubleshooting

When a webhook fails during data collection, the respondent continues through the survey uninterrupted. A status code and message are logged to their data record. A status of "None" typically means the webhook failed to send or the response failed to save. A 400 or 500 status means the webhook failed in the receiving system. 

JSON payload exceeded max size (15 MB): The payload exceeded the 15 MB limit. Reduce the number of fields sent or exclude open-end questions likely to collect lengthy responses. 

JSON payload exceeded max nested levels (64 levels): The payload exceeded the maximum of 64 nested levels. Review your custom JSON structure and reduce nesting. 

Unable to prepare payload due to invalid JSON: The payload could not be converted to valid JSON. Check your custom JSON for syntax errors such as missing commas, brackets, or quotation marks, or unexpected characters in piped-in respondent answers. 

Connection request timed out: The receiving system didn't respond in time. Verify it's online and reachable and confirm the endpoint URL is correct. 

Too many concurrent requests: Multiple webhooks on the same event target couldn't all be sent within the 10-second window. Reduce the number of webhooks on the event target or distribute them across multiple targets. 

Unable to record response (timed out or payload was too large): The webhook was sent successfully but the response couldn't be recorded — either it arrived too late or the response payload was too large. Check the response time and payload size returned by the receiving system. 

Missing property in webhook request: This isn't an error. Discover omits properties with null values — for example, unseen questions. To send a value in these cases, set up a custom variable that returns a placeholder like "not seen."