7 Replies Latest reply on Nov 3, 2018 10:02 PM by Sanford Whiteman

    Push Lead to Marketo not working

    Steve Strongbad

      We're currently using the Push Lead To Marketo part of the API because we have an anonymous lead that needs to be sent over via the API to be created and linked to the cookie ID that is sent over.  We're setting the lookupField as 'mktToken' and sending the correct token but it's giving us an error saying that the 'mktToken' is not found and asking for an 'id' field.  In php, using the class from: GitHub - Marketo/REST-Sample-Code: Marketo REST API sample code.  We're using the 'PushLeadToMarketo.php' class.  Here is the result:

       

      {"requestId":"17bf6#166d5d432a1","result":[{"status":"skipped","reasons":[{"code":"1006","message":"Field 'mktToken' not found"},{"code":"1003","message":"Value for requried field 'id' not specified"}]}],"success":true

       

       

      Here is the lead being sent:

      stdClass Object

      (

          [email] => jwhitehead+fri13@test.com

          [appointmentType] => Prospective Client Phone Meeting

          [requestConsultationSubmissionDate] => 2018-11-02 13:09:05

          [requestConsultIdealTime] => 2018-11-03T21:00:00Z

          [mktToken] => id:815-VVR-763&token:_mch-dentistadvisors.com-1539376101028-96212

          [firstName] => test

          [lastName] => test

          [phone] => test

          [howDidyouhearaboutReese] => your mom

          [RequestConsultReason] => test

      )

       

       

      Anyone have any ideas on why this isn't working?

        • Re: Push Lead to Marketo not working
          Jep Castelein

          I'm not familiar with the PHP code, but it appears like you've set lookupField='id' instead of 'mktToken'. Therefore it makes 'id' required and interprets 'mktToken' as a regular field (which it isn't)

          • Re: Push Lead to Marketo not working
            Sanford Whiteman

            You need to know what JSON payload you're putting on the wire. This isn't a language-specific question, but about the contract w/the REST API, which is language-independent. (Also pls highlight JSON/code using the Advanced Editor's syntax highlighter when you do post it, so it's readable.)

             

            In general, there are 2 problems here:

             

            1. mktToken isn't the Munchkin cookie, it's the mkt_tok associator query parameter. cookies is the property representing the Munchkin _mkt_trk browser cookie.
            2. You're assuming Push Lead associates all previously anonymous activity, which it does not. You need to use the Associate Lead endpoint, costing another API call.

             

            It would also be good if you explained why you're using the REST API instead of the much more resilient and scalable Forms JS API.