First, configure the webhook in the relevant widget (e.g. poll, quiz, survey, etc) creation form:

  1. Edit the widget creation form
  2. Go to the "Integration Settings" section
  3. Set on the "Enable custom webhook" checkbox and configure the URL you want the data to be sent to.

After the webhook is configured, each time the user submits answers in the widget, Opinion Stage will send the submitted data to the configured URL.

Note that the data sending occurs 1-2 minutes after the submission.

In what format is the data sent?

Opinion Stage sends the data via a POST request to the configured URL. The data is encoded as JSON key-value pair in the body of the request. Keys can be found in the webhook configuration page ("Webhook key"), and corresponding values are the actual data (e.g. answer to card) submitted to that key.

Examples:

To illustrate how the system sends webhook data, following are some examples:

curl command-line utility:

curl --data '{"key": "value"}' -H 'Content-Type: application/json' -- https://acme.co/webhook

php cURL:

<?php
$url = 'https://acme.co/webhook';
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"example":"payload"}');

curl_exec($ch);

curl_close($ch);
?>

Best practices

  1. Use an  HTTPS url for webhooks, so the data is sent encrypted and secure.
  2. Verify the webhook url is always accessible. Note that if data is sent to a URL that doesn't respond, Opinion Stage tries sending a few times before failing.
Did this answer your question?