We built Riddle to easily connect with any marketing software or CRM tool. Our new quiz webhook joins our existing range of data connection options, from using Zapier to native integrations with AWeber and MailChimp (with more coming!).

The use cases are endless. You can auto segment leads based on their responses, automatically send data to your marketing software for instant email follow ups, and a million more.

Quiz webhook: the essentials

Now we are going to get your inner geek going at full speed and show you how to write your own quiz webhook with just a few lines of PHP.

To get started, it would be good if you have:

  • a good understanding of PHP
  • a bit of knowledge about JSON
  • your own server or a cool place where you can upload a PHP file that is reachable on the web
  • a Riddle Pro or Enterprise account or a free 14 day trial account with all features unlocked

Quiz webhook: getting started

  1. Right, first off – create any Riddle quiz, poll, or other content.
  2. Include a lead gen form using Riddle’s lead form builder.
  3. Go to the integrations tab on the create screen.
  4. Here you paste the URL of the page where your personal webhook code will run. (Something like: http://mydomain.com/riddle_is_awesome.php
  5. Save and publish the Riddle and run through it one time, filling out the form to make sure it all works.
  6. Then create a php file with this tiny bit of code:

 $data = file_get_contents('php://input');
 $req_dump = print_r(json_decode($data), true);
 file_put_contents( 'request.log', $req_dump );


As you can see in the image on the right, Riddle’s quiz webhook sends you all data as a nicely formatted JSON string via POST.

All you need to do is grab that POST JSON and process it as you like.

The sky is the limit of where you can go from here. You can write your own code to:

  • push the Riddle data to a CRM of your choice
  • write it all into your own database
  • build your own personal Riddle dashboard
  • and dozens of other use cases

Need help or custom code? Reach out to us via hello@riddle.com and we’re happy to help. Basic questions are easy and free – but we’re also available for hire to write your own webhook if you don’t have the code background).

The code above is just a starting point. Use this improved PHP code to process the data sent through to your hook if you know your way around PHP (as you will see below, this code is just a starting point. It does not really do anything with the data yet)

Don't know where to start coding your own Riddle script or quiz webhook?

No worries, we got you covered.

Check out our Github repository for cool sample scripts.

This is the output in the request.log file generated by the code on the left

JSON grab from Webhook