Need the ability to write the Marketo Custom Object information to Salesforce object

Anonymous
Not applicable

Need the ability to write the Marketo Custom Object information to Salesforce object

Hi,

We have a requirement to sync the Marketo Custom objects (call it Sample-M) with a similar Salesforce custom object (call it Sample-S) records. The Marketing team has access to only marketo and hence, the data is written in to the Sample-M records and is visible in the marketo user interface. Now, the requirement is to create/update the Sample-S records on insert/update of Sample-M records. This can be obtained by invoking the API webservices of Salesforce using marketo webhooks.

In doing so, I am faced with 2 limitations:

1. How do I authenticate the API call from a marketo webhook? If I use any other platform than marketo, this is done in two steps - first call to authenticate and get an authorization token from Salesforce; and the second call to insert/update the data in Salesforce by including the authorization token in the HTTP request. Marketo webhook allows me to only use one call. Is there a way to accomplish this?

2. In webhooks, I am only able to get the data of the standard marketo objects only, eg., Leads, Company, Campaigns, etc. There is no option to include the data of marketo custom objects. In the body of the API request, I need to pass the information of marketo custom object. How can I get the data of the Sample-M records to be included in the request?

Thanks in advance

10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

1. How do I authenticate the API call from a marketo webhook? If I use any other platform than marketo

That's a generalization: what you really mean is if I do not use webhooks or other single-request HTTPS clients.  Webhooks were not designed to be stateful, whether sent by Marketo or anywhere else.

The answer is to use the webhook to call an intermediate service that can run both the authentication request-response and the data request.

2. In webhooks, I am only able to get the data of the standard marketo objects only, eg., Leads, Company, Campaigns, etc. There is no option to include the data of marketo custom objects. In the body of the API request, I need to pass the information of marketo custom object. How can I get the data of the Sample-M records to be included in the request?

Why can't whatever you're using to update the Sample-M records do a two-phase commit of Sample-S records? 

Anonymous
Not applicable

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

Thanks for your response. First, we do not want to include a middleware and wanted to directly keep marketo and salesforce in sync. Also, as I understand from your comment, we cannot get the Sample-M record info from marketo (within webhook), but have to make the api call from the point where we are inserting/updating the Sample-M records to insert/update Sample-S records as well. Correct me if I am wrong.

SanfordWhiteman
Level 10 - Community Moderator

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

That's correct, you should use the insertion point to commit both Sample-M and Sample-S records.  This gives better error control anyway.

Beyond that you would have to build some sort of intermediate tier.

Anonymous
Not applicable

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

Hi Sanford,

Could you not build a chain of webhooks to handle the Salesforce auth response and then use the to post data?

My thinking was this

Salesforce auth webhook makes initial auth call and maps the response.

Salesforce data webhook uses mapped session_id response to post data

SanfordWhiteman
Level 10 - Community Moderator

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

It's a fragile setup, but it's been done. Note you must trigger on Data Value Changes on the field you're using to store the session_id.  You can use Webhook Was Called to catch some errors. 

But I vastly prefer to coordinate this via another tier. I would always worry about stability when I had things like this in place.

Anonymous
Not applicable

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

I actually have no experience with web hooks but was also considering hosting an intermediate python SFDC API wrapper on Heroku. Is that more what you were thinking?

SanfordWhiteman
Level 10 - Community Moderator

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

Sure, a webhook has these fundamental differences from just any old HTTP endpoint:

  • is stateless (thus why it's a departure to try to synchronize two separate webhooks)
  • needs to have a cap on response time, since it will be called synchronously in a flow
  • should not cache results unless well-documented, since it will be called from different lead contexts
  • sometimes needs to be idempotent to protect against unexpected retries (this isn't part of any spec but I've found it to be the case)
Jep_Castelein2
Level 10

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

I have built several Webhook solutions that call the SFDC REST API. It is not my preferred method, but sometimes it's the only way that we can do something quickly. The trick is to get a token and save it in a Lead field using the first Webhook call. Then use that token in the second webhook call. Obviously it's inefficient (need to request the token every time & token stored on each Lead record rather than somewhere centrally) and not super secure (every Marketo user with Lead Database permissions can see the SFDC token). But it works. Error handling is not that great.

Regarding the 2nd requirement: Webhooks cannot access Custom Object data, so it's probably not a feasible solution. Indeed, the process that inserts the Marketo Custom Objects could be updated to also update SFDC, or you could switch to SFDC Custom Objects that sync back to Marketo using the native sync. Or you could copy some of the Custom Object data into Lead fields, which you then sync via the regular SFDC sync. Maybe even write a Custom Trigger in SFDC to take updated data in those fields and copy it to the Custom Objects.

Anonymous
Not applicable

Re: Need the ability to write the Marketo Custom Object information to Salesforce object

Thanks Jep,

One application I was thinking of was to insert new Marketo person records into SFDC as contacts, then have SFDC trigger attach that contact to the proper account, likely based on domain name. Thoughts?

Also, what are the chances of you sharing the structure of your auth and post webhooks?