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.

Code examples: connecting Riddle to different software

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. You can find the complete repository with working code on GitHub.

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