I'm having an issue importing data from a webhook into marketo. This data is coming from a Jotform (www.jotform.com). I'm sending the data from the form to a webhook on my web server. The code in the webhook is:
<?php
//Strips all slashes in an array
function stripslashes_deep($value){
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
$result = stripslashes_deep($_REQUEST['rawRequest']);
//Convert json to php variable
$obj = json_decode($result, true);
//Initialize input variables
$theName = $obj['q1_name'];
$theEmail = $obj['q3_email'];
?>
<!----------------Marketo Munchkin API------------------------------>
<script src="http://munchkin.marketo.net/munchkin.js" type="text/javascript"></script>
<script>
mktoMunchkin("OUR_ACCT_ID");
mktoMunchkinFunction(
'associateLead',
{
Email: <?php echo "'" . $theEmail . "'"; ?>,
FirstName: <?php echo "'" . $theName . "'"; ?>,
},
'<?php echo hash('sha1', 'our-secret-key' . "'" . $theEmail . "'"); ?>'
);
</script>
<!---------------------------------------------------------------->
And obviously, "OUR_ACCT_ID" and "our-secret-key" are using our actual values.
However, no data is coming into Marketo at all. Any ideas where I'm going wrong? I can get the munchkin script to work if the user actually visits that php file and brings the $_POST values from the form with them ... but it doesn't work if the values are sent over a webhook to my php file with JSON. Any help would be awesome, I can't figure out why it won't connect. Thanks!