Push Lead to Marketo not working | Community
Skip to main content
November 2, 2018
Question

Push Lead to Marketo not working

  • November 2, 2018
  • 2 replies
  • 4504 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jep_Castelein2
Level 10
November 2, 2018

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)

SanfordWhiteman
Level 10
November 2, 2018

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.

November 2, 2018

The way this works, is a user goes to a landing page and then a popover displays after clicking a button to schedule a meeting.  That popover is an iframe from Appointlet.com.  Then after they fill out the schedule form, Appointlet make a webhook call to our script that will then take that form information to put it into Marketo.  The problem is that we need merge the anonymous lead to the info coming back from Appointlet.  I not really a way I could see that would make this function without using the API.

SanfordWhiteman
Level 10
November 2, 2018

Well, first of all -- though this is in its own way less scalable than I would desire -- if they're capable of relaying the form data in a webhook call, and they use form-url encoding (not JSON), then you can send that data directly to the Marketo forms endpoint.  It's not unlimited because there is (or at least historically was) a daily limit per IP address of 43,200 form posts.  But a malicious user of that workflow can never affect other API integrations, nor does it get subtracted from your REST/SOAP API limits.

Without knowing whether they have a client-side JS API, I couldn't say whether you'd be able to use the Forms JS API to send data to Marketo from the browser, which is the best practice. But merely having an IFRAME doesn't mean they can't have a cross-frame API, that's the way YouTube works for one of many examples.