Help with Webhook for Anonymous sync w/ SFDC import

David_Kaplan
Level 2

Dear @SanfordWhiteman


I have spent many hours sifting through general guidance, hints, and scattered implementation details that you have kindly offered in posts over the past 5 or more years regarding regarding associating imported SFDC leads with existing anonymous leads.  I've now spent many more hours trying to understand and implement the solution for my client.  It's all been slow going since although I have a technical background, Marketo is new territory.  I've tried very hard to figure this out myself, but I'm not quite there, and hoping you would be willing to help me out.

I have created a loopback webhook with the following values:


URL: http://localhost/index.php/leadCapture/save
Payload Template: munchkinId={{lead.Marketo Munchkin}}&FormId=1024&Email={{lead.Email Address}}&returnLPId=-1
Request Token Encoding: Form/Url
Request Type: POST
Response Format: None

{{lead.Marketo Munchkin}} is an imported SFDC field containing the munchkin value from a (non-Marketo) form generated lead.

I've created a webhook monitoring operational campaign that is checking for something other than a 302 response.  I call the webhook from another campaign where I've been testing on individual leads that have a munchkin value in the  {{lead.Marketo Munchkin}} field.  

My main difficulty at the moment, is that I don't know how to check or debug the result of the webhook call.  I'm not seeing associated website activity for the individual record I've tested.  It seems that the webhook call is returning a 302, but beyond that I can't figure out how to determine if the parameters and values I've chosen in the webhook payload are correct.  Is there any way to get more results from the loopback call then whether the response code was 302?

One thing I'm not seeing in any activity log is the name of the form I created, #1024 referenced above.  While I do see activity indicating the webhook is getting called, and the monitoring is getting called.  This is the kind of question a little more system feedback would be helpful with.  I tried enabling a JSON response instead of none, and returning the "success" parameter in the webhook response mapping, but this didn't seem to work.  And I'm afraid this demonstrates where my experience is limited and my understanding is incomplete.  Any help would be appreciated. 

Update: now it seems the webhook is not returning "HTTP Error 302: URL moved temporarily."  I'm quite sure it was returning that earlier in my testing, but won't swear to anything.  In any case, I'm faced with a similar dilemma, how do I determine what code is being returned if it's not 302?

Thank you,
David L Kaplan

27 REPLIES 27
SanfordWhiteman
Level 10 - Community Moderator

Positive you have munchkinId correct? Error there throws a 404. Pretty sure there's something fundamentally wrong w/your request.

David_Kaplan
Level 2

There is likely a problem here, as currently I am entering the entire cookie value with an unescaped ampersand before the token part, which is going to mess up the post data.

What should go in that field?  The id, the token, or both connected with an escaped ampersand?  Or something else?  I can't find documentation on this.

David_Kaplan
Level 2

Ok, good news and bad news.

Good news, I changed the value in the munchkinId field to be just the id value, and for the first time there was a call to the form in the activity log and a 302 return.  Hurray!

Bad news is, I'm confused about how the sfdc imported lead and anonymous lead get associated without specifying the cookie token information in the webhook payload.  

SanfordWhiteman
Level 10 - Community Moderator

You have to pass the URL-encoded Munchkin cookie value as the _mkt_trk form field. That originally comes from the _mkto_trk cookie value (note the cookie name has an extra "o" that the form field does not).

David_Kaplan
Level 2

Thank you Sanford!  I can see light at the end of this tunnel!  I need to do some more testing to confirm it's working.  I also need to look into updating the cookie values I've stored, because I didn't store them urlencoded.  I'll update here after all is working.

David_Kaplan
Level 2

I'm very relieved to hear you say that!  I very much want this to work.  Thanks for sticking with me in this process.  I'll follow up in a bit.

David_Kaplan
Level 2

Thanks!  I'll try those adjustments!