Integration with Marketo Through Webhook for Associate Leads

  • Profile Image
    ekidman
    Asked on November 13, 2013 at 07:03 PM

    Has anyone successfully imported leads from a Jotform webhook into the Marketo CRM?? I can get it to work by using a custom Thank You page and including the following code:

    ----

    <script src="//munchkin.marketo.net/munchkin.js" type="text/javascript"></script>
    <script>
      mktoMunchkin("OUR-ACCT-ID-HERE");
      mktoMunchkinFunction(
       'associateLead',
       {
          Email: <?php echo "decodeURIComponent(\"" . rawurlencode($_POST["email"]) . "\")" ?>,
          FirstName: <?php echo "decodeURIComponent(\"" . rawurlencode($_POST["name"]) . "\")" ?>,
       },
       '<?php echo hash('sha1', 'our-secret-key-here' . $_POST["email"]); ?>'
    );
    </script>

    ----

    However, this is not completely ideal as I have to redirect them to a different page to make any of this happen. I'd prefer to use the default thank you page without having to redirect them. I've tried similar code with a webhook, but can't get it to work. I'm not real familiar with webhooks, but I did look at the output using http://requestb.in and attempted to use this code:

    ----

    function stripslashes_deep($value){
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);
        return $value;
    }
    $result = stripslashes_deep($_REQUEST['rawRequest']);
    $obj = json_decode($result, true);
    $name = $obj['q1_name'];
    $email = $obj['q3_email'];
    ?>

    ----

    to get the $name and $email variables, but nothing seemed to work. I'm completely stuck, any help would be great!

  • Profile Image
    ardy0689
    Answered on November 13, 2013 at 08:48 PM

    Hello, Thanks for creating a separate thread.

    After researching on Marketo API, I come up with this similar to yours but with minor adjustments. You may use this code and save it as a PHP file, then you can upload it to your own server. After that, attach this file on your form as Webhook.

    http://pastiebin.com/52842b29dcfba

     

    Please adjust the code and put your Account ID and Marketo API secret keys.

    If you need further assistance, please do not hesitate to ask. Thank you

  • Profile Image
    ekidman
    Answered on November 14, 2013 at 04:34 PM

    Thanks for the code. The PHP is executing perfectly, and I confirmed that it's grabbing the correct values for $theName and $theEmail by writing those variables to a file. However, the script going to Marketo doesn't seem to run. This same script runs fine when using it in a custon Thank You page - but won;t run when using the webhook. Any ideas??

  • Profile Image
    ardy0689
    Answered on November 14, 2013 at 05:40 PM

    Hello. Thanks for the update.

    It is hard for me to test it out as Marketo does not have free trial without going into business talk with them for approval of free trial.

    Can you please paste your current code you copied from the link I provided?

    Please use PastieBin and post the link here on the forum. I have updated a revision of the code earlier so I am not sure if what you copied is the old one or the latest revision I made earlier before you replied.

    We will wait for your reply. Thank you

  • Profile Image
    ardy0689
    Answered on November 14, 2013 at 05:51 PM

    I would like to add I just read this from Market API page:

    "To get the API names for the fields, go to the Field Management page of the Admin section.  Then click the Export Fields button.  The API field names will be in that spreadsheet."

     

    So your "Email" and "FirstName" from the code might not really be the ones used on your Marketo list

     

    Regards

  • Profile Image
    ekidman
    Answered on November 14, 2013 at 06:07 PM

    ardy,

    Thanks for your response. I used the exact code you have posted above. Mine is http://pastiebin.com/528556c58ec11. I'm wondering if it is something on Marketo's end... I posted a question to their forum to see if anyone over there has any idea. I'll post back if I find anything out. In the mean time, if you have any other insight, I'm willing to give it a shot.

    And in response to your second response, I just double checked, and the field names are correct (FirstName and Email).

  • Profile Image
    ardy0689
    Answered on November 14, 2013 at 06:24 PM

    I just created 2 new revisions from my pastie bin.

    Revision 4

    Revision 5

    Please try the 2 links and see which one would work from your end. Thanks

  • Profile Image
    countrywalkers
    Answered on March 18, 2014 at 11:34 AM

    I hope you don't mind me reviving this older thread. We are trying to accomplish something similar—trying to have JotForm and Marketo communicate via a webhook, but don't have the in-house expertise to program it. Anybody out there available for help/hire? Thanks for letting me know.

  • Profile Image
    Welvin
    Answered on March 18, 2014 at 01:51 PM

    @countrywalkers,

    We can help. However, we advise to create your own thread using this link: Contact JotForm Support. Include the required information such the codes.

    Thanks