Skip to main content
All CollectionsIntegrations
How to Use Webhooks to Send Data to 3rd Party Applications
How to Use Webhooks to Send Data to 3rd Party Applications

An article explaining how to use webhooks to send data submitted in Opinion Stage items to a 3rd party application

Dima Mjakotnyj avatar
Written by Dima Mjakotnyj
Updated over a week ago

This article explains how to create your webhook function.

Before starting, note that can also simplify/speed up the process by using a mediator which will make the configuration as easy as clicking a few buttons. If you would like to use Zapier.com (one of the most popular ones) as your mediator, check out this article - How to use Zapier to send data to 1000's of applications

How to configure Webhooks

Start by configuring the webhook in your item:

  1. Edit the item

  2. Go to the "Connect" tab

  3. Go to the "Webhooks" sub-tab

  4. Enable the "Webhooks feature

  5. Configure the URL you want the data to be sent to, and click Save

Once a user completes answering all the questions in the item, Opinion Stage will send the submitted data to the configured URL.

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 pairs in the request's body. Keys can be found on the webhook configuration page ("Webhook key"), and corresponding values are the actual data (e.g., answer to card) submitted to that key.

Example payload:

{
"widget-id": "c524d12e",
"question-bd5482ac-title": "How would you describe your style in the kitchen?",
"question-bd5482ac-answer": "Freestyle! I go with my gut and improvise",
"result-title": "Free Spirit",
"result-text": "You're ready for a food adventure, always seeking out the next hole-in-the-wall spot serving up the best next thing nobody has heard of yet. In the kitchen, you follow your instincts.",
"submitted-on": "2022-09-26T14:17:01Z",
"hosting-url": "https://example.com",
"os-utm-source": "twitter"
}

Example

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

curl command-line utility:

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

<?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 it a few times before failing.

Note

Note that we don't track responses when the item is previewed in the builder, so test the item submissions with the Opinion Stage landing page or with your embed.

Did this answer your question?