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.

5200
16
16 Comments
Anonymous
Not applicable

I cannot get the PUSH api to accept a field named cookie at all.

POST to <server>/rest/v1/leads/push.json

{

    "programName": "xxx",

    "source": "xxx",

    "reason": "Form Fillout",

    "lookupField": "email",

    "input": [

        {

            "email": "test@example.com",

         "firstName": "testxxx",

         "cookie": "id:999-<xxx>"

         }

     ]

}

gives me back:

{

    "requestId": "561#15cefe249ec",

    "result": [

        {

            "status": "skipped",

            "reasons": [

                {

                    "code": "1006",

                    "message": "Field 'cookie' not found"

                }

            ]

        }

    ],

    "success": true

}

Jon_Wu
Level 4

I've concluded and verified with support that push cannot have anything to do with cookie association. The only way to associate cookies is via associateLead with Munchkin, associateLead with the REST API, or by submitting a form with the cookie - either normally from a client / browser or from server side POST.

SanfordWhiteman
Level 10 - Community Moderator

...verified with support...

I wish they'd stop verifying things that aren't totally true.

This endpoint actually can associate leads with formerly anonymous cookies. Example request payload:

{

    "programName": "API Association",

    "source": "Outside Site",

    "reason": "Visited Web Page",

    "lookupField": "email",

    "input": [

        {

             "email": "marketotestpush+01@gmail.com",

             "cookies": "id:111-XOR-333&token:_mch-s.codepen.io-1498705469993-12345"

         }

    ]

   }

This will associate new web activities under that cookie with the new lead.

However, the problem I've found is that it doesn't back-fill activities, only forward-fills them after the time of association (which is sort of like having cookieAnon:false). So the functionality is self-defeating in a way, especially if you're looking to batch requests, since you may not know the cookie-email correlations until well after the person has closed their browser.

Jon_Wu
Level 4

Hmm that's pretty interesting, but if it doesn't back-fill activities, that's a non-starter for us.

On a semi-related note, I'm about to roll out a big change you suggested to route all cookies through our Salesforce instance, then delay association until the Salesforce lead syncs to Marketo, but I wonder if this will break campaigns that send emails.

For example, if I have a campaign that will send an email with the trigger being a specific Visits Web Page activity, in the past, I'd call associateLead from Munchkin, then trigger the web page activity so it'd happen for a lead with an email. Then that smart campaign would send an email.

Now, I'd create the lead in Salesforce and have the cookies added to that lead, then log the web activity without calling associateLead from Munchkin (anonymous in Marketo's eyes). Then, within a few minutes, Salesforce would sync to Marketo, and I'd trigger a webhook to associate the Munchkin cookie with the lead, at which point the previously anonymous Visit Web Page activity would retroactively be associated with the new synced lead from Salesforce, which has an email too.

In this scenario, would my email fail to send since the Visit Web Page event happened before Marketo knew the email? If so, I'm sad I forgot about this major issue, is there any workaround?

Digital_Pi66
Level 1

Thanks Sanford.  I noticed in your sample you use  "cookies" for the field name.  Not "cookie" and not "mktToken" as the Push documentation example uses. 

So it seems the documentation has an incomplete description and a completely wrong example.

SanfordWhiteman
Level 10 - Community Moderator

Right. It wouldn't be the mktToken anyway (that's a different lookup). The docs are really confusing on this.