Want to send your quiz leads and responses automatically to your favorite marketing software or data warehouse?

Send quiz leads & data to your favorite software with a webhook

Our webhook will send the quiz data to your system – for each person who completes your included lead generation form.

Riddle has a wide range of native integrations – including Mailchimp, ActiveCampaign, Google Sheets, and more.

But if you have different software – a webhook is a great solution.

What’s a webhook? Check out this great overview – especially the difference between APIs and webhooks.

Securing your webhooks

You can secure your webhook with a signature. This will ensure that all data received on your endpoint is coming from your Riddle and not from someone trying to exploit your webhook. Please read our dedicated article on webhook signatures for more information.

Legacy Riddle 1.0: Code examples: connecting Riddle to different software

If you are still working in our old version of Riddle, here are some examples how you can use our webhook to integrate with your various data systems.

The following code snippets are just extracts and not working examples.

Simple logger:

<?php 

$logger->log($riddleData->getData());

SwiftMailer (examples for native PHP mailer and PHPMailer are included):

<?php

$message = Swift_Message::newInstance()
        ->setSubject(getMailSubject($riddle))
        ->setFrom(array($fromMail => $fromName))
        ->setTo(array($toMail => $toName))
        ->addPart(getMailBody($riddle), 'text/html');

$transport = Swift_MailTransport::newInstance();

$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);

Send riddle data to your Google Spreadsheet Document (although you can also use our native Google Doc integration):

<?php

$client = new Google_Client();
$client->addScope(Google_Service_Sheets::DRIVE);
$client->addScope(Google_Service_Sheets::SPREADSHEETS);
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . $authConfigFile);
$client->useApplicationDefaultCredentials();

if ($client->isAccessTokenExpired()) {
    $client->refreshTokenWithAssertion();
}

$riddleData = new RiddleData(file_get_contents('php://input'));
$riddleSpreadsheet = new RiddleGoogleSpreadsheet($client, $spreadsheetId, $worksheatId);
$riddleSpreadsheet->insertRiddleResponse($riddleData);

Leave a Comment