SOLVED

Re: Templates for Using a webhook to post leads to a partner

Go to solution
Conor_McCormick
Level 2

Templates for Using a webhook to post leads to a partner

Hi All,

Is there any good documentation or templates for using Marketo webhooks to post leads to a partner's url? We want to take leads as they are incoming to our Marketo instance and then pass them along to a partner via HTTP Post. I can find ample documentation on GET in the Marketo documentation, but nothing on POST. Really just looking to get the standard contact fields over to the partner. The partner has requested the data to be sent in JSON format. Everything I've tried so far as returned a system error in the response.

Any templates or guides that anyone has for what to put in the payload template would be awesome.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Templates for Using a webhook to post leads to a partner

Don't quote your tokens. By using JSON request encoding the tokens are already quoted.

View solution in original post

8 REPLIES 8
SanfordWhiteman
Level 10 - Community Moderator

Re: Templates for Using a webhook to post leads to a partner

This isn't something that can be concretely answered on the Marketo side. Every remote endpoint can require a different schema to represent a lead. The more info you provide here, including ​what you've tried, the more we'll be able to help.

If it's JSON they want, you'll set your request encoding to JSON (and should also add a custom header Content-Type: application/json) and then create a valid JSON object. Roughly like so, but I have no idea what their fields are:

{

  "First Name" : {{Lead.First Name}},

  "Last Name" : {{Lead.Last Name}},

  "Email" : {{Lead.Email Address}}

}

Conor_McCormick
Level 2

Re: Templates for Using a webhook to post leads to a partner

This is one of my attempts - I did not have the custom header set though:

{

"LeadID": "{{lead.SFDC Id:default=No SFDC ID}}",

"FirstName": "{{lead.First Name:default=Not Entered}}",
"Last Name": "{{lead.Last Name:default=Not Entered}}",

"Email": "{{lead.Email Address:default=Not Entered}}",

"State": "{{company.State:default=Not Entered}}",

"PrimaryPhone": {{lead.Phone Number:default=Not Entered}}

}

SanfordWhiteman
Level 10 - Community Moderator

Re: Templates for Using a webhook to post leads to a partner

Don't quote your tokens. By using JSON request encoding the tokens are already quoted.

Conor_McCormick
Level 2

Re: Templates for Using a webhook to post leads to a partner

Oh crap. Stupid Stupid. I'll fix that.

Conor_McCormick
Level 2

Re: Templates for Using a webhook to post leads to a partner

So got it mostly working, thanks for the assist. Turns out the partner actually didn't have it set up correctly on their end either, so even if I had it right, it would have rejected.

Colin_Campbel
Level 2

Re: Templates for Using a webhook to post leads to a partner

Hi Conor, would you be able to share that documentation you found for the GET webhook to provide leads to a partner?

Conor_McCormick
Level 2

Re: Templates for Using a webhook to post leads to a partner

This is a good starting point for webhooks. If you are providing leads to the partner, you'd use a POST webhook to send info. For the partner to send information back to you, they'll need token access to the REST API.​ For technical info on updating the leads via the API calls see here.

SanfordWhiteman
Level 10 - Community Moderator

Re: Templates for Using a webhook to post leads to a partner

Using a webhook to both post lead data and update to lead fields (webhooks do both) is preferable to using the REST API lead-by-lead.