Slackbot Hates Server Side Post

John_M
Marketo Employee
Marketo Employee

It's true. Here at Marketo we use Slack, and our Slackbot HATES server side post.. so much so that when you mention it, it chastises you. It's really pretty amusing.

Slackbot.png

Fine! Jeez.

Really though, Slackbot is completely right. Server side post has effectively been replaced by the following REST endpoint, which is great and scalable.

http://developers.marketo.com/rest-api/lead-database/leads/#push_lead_to_marketo

This, along with my other most recent blog, provide a good blueprint for associating leads in a non marketo form with only one REST call. No fewer than 3 customers have had this very question for me this week alone, so it seems like a hot topic.

5203
16
16 Comments
Justin_Norris1
Level 10 - Champion Alumni

Hey John Mattos (W)​,

Thanks for writing about this stuff.

I have two questions:

1) Under what circumstances would you want to use Push Leads instead of us Submitting a Hidden Form with the Forms 2 API? A hidden Forms 2 submit is the method I have been using and recommending (admittedly influenced quite a bit by the advice of Sanford Whiteman​), as this method uses no REST calls at all.

I'm interested in your perspective on the relative merits of the two approaches.

2) I've reviewed the documentation for Push Leads a few times. (I'm not a developer so I read it slowly .) A few things are confusing me:

a.

In addition to synchronization of lead fields, this endpoint allows for lead association based on cookie values which are passed to the endpoint.  This is done by passing the mkt_tok value generated by clicking through a Marketo email...

The mkt_tok value when you click on an email is different than the ID in the _mkto_trk cookie.

If you are trying to simultaneously create a new lead and associate it with a cookie (which is a primary use case for associating non-Marketo form fills), you don't have any Marketo email mkt_tok value to use, because it is a new lead who has never received a Marketo email. All you have is the the ID contained in the _mkto_trk cookie.

So how would Push Lead work in that scenario? Is it possible to associate the _mkto_trk cookie value with a lead using the Push Lead call?

b.

...or by passing a program name in the call.

How does passing a program name in the call allow you to associate a cookie with a lead?

Sorry if I'm missing something here.

Thanks!

John_M
Marketo Employee

Hi Justin Norris

Im glad you're finding it useful!

Sanford is a great resource, so im sure you're getting good advice. It all comes down to client or server side, with thee Forms 2 API being on the client, and REST on the server. Just depends on how your pages are designed, both are equally good options.

I wrote another blog to talk through the cookie values, and the confusing stuff there.. ( Associating Leads with Non Marketo Form Fills  ) but keep in mind with munchkin on the page, a hidden field called _mkt_trk will get populated with the cookie value with no extra JS required.

Check that blog out and see if it answers your question here.

As for the program name, that parts I havent used yet, so I cant speak to it.

Jessica_Cross1
Level 6

Nice use of Slackbot.

My director of SDRs wanted to know if I could turn our aging MQ report into a slack bot.  Where there is a will there is a way, right?

Jon_Wu
Level 4

Justin Norris wrote:

If you are trying to simultaneously create a new lead and associate it with a cookie (which is a primary use case for associating non-Marketo form fills), you don't have any Marketo email mkt_tok value to use, because it is a new lead who has never received a Marketo email. All you have is the the ID contained in the _mkto_trk cookie.

So how would Push Lead work in that scenario? Is it possible to associate the _mkto_trk cookie value with a lead using the Push Lead call?

I'm wondering the same thing. Justin, is it possible?

SanfordWhiteman
Level 10 - Community Moderator

Yes, the cookie value is one of the possible associators (as it also is with the older syncLead/associateLead methods). It's the mkt_tok that's a newer option.

Jon_Wu
Level 4

Regarding this:

Is it possible to associate the _mkto_trk cookie value with a lead using the Push Lead call?

How would I do that?

I see that if you have a _mkt_tok, you can pass it into the push leads API as a mktToken key, but could you use the Push Lead call as a bulk Associate Lead call for a _mkt_tok / Munchkin cookie? This would allow us to associate tracking cookies in bulk (to preserve API calls), and do it by email instead of lead ID.

SanfordWhiteman
Level 10 - Community Moderator

"lookupField" : "cookie"

No?

Jon_Wu
Level 4

Bummer, bulk associate would be awesome!

I'll resort to 1 call per cookie association using a form POST by default, with a fallback to associating via REST API in case that stops working or in case my server's IP is rate limited or banned.

Although it wouldn't help this use case, I tried "lookupField": "cookie" for kicks, but that doesn't work.

Error: 1006 - Lookup field 'cookie' not found

SanfordWhiteman
Level 10 - Community Moderator

Has to be supported, otherwise the endpoint doesn't make a whole lot of sense.

I'm on a plane right now so can't verify, but try lookupField:email and pass cookie:<cookie value> in the lead record.

Jon_Wu
Level 4

I tried that too but no luck. Perhaps it's not possible? It seems like the intent of the push API is to upsert leads and update fields by either email or by mkt_trk token from an email link. However, I couldn't find any docs to indicate that you'd actually be able to associate a Munchkin tracking cookie with it. The only reason I thought to try was that Justin Norris​ above was asking if we could use push to associate, and your post here https://nation.marketo.com/blogs/marketowhisperer/2016/10/25/associating-leads-with-non-marketo-form... implied that perhaps Push Lead could replace Get and Associate.

For posterity, here's what I just tried

Request

POST https://<munchkinId>.mktorest.com/rest/v1/leads/push.json

{"programName":"Push Leads Test","lookupField":"email","input":[{"email":"test@example.com","firstName":"Updated via push leads w/ cookie","cookie":"id:..."}]})

Response

[{"id":123456,"status":"created"}]

I was hoping I could associate 300 tracking cookies at once if this worked out, but without it there's still the form submit or associate REST API for 1 cookie at once, so no biggie.

The more concerning thing is that I seem to have created multiple duplicate leads somewhere between the 3 things I'm testing:

1. Push lead via REST (docs say "this is always an upsert operation")
2. Submit form (docs say "an anonymous lead is merged into a new or existing known lead when someone: ... Fills out a Marketo form)

3. Use REST API to associateLead​ (I'd assume this should behave similarly to associateLead in Munchkin and the docs from #2 say that scenario should also merge leads for you)

Shouldn't duplicates be impossible for these scenarios?