Re: Can the SOAP API be used to add a new lead to Marketo?

Anonymous
Not applicable

Can the SOAP API be used to add a new lead to Marketo?

We'd like to create a new lead record in Marketo whenever someone creates a new user login in our SAAS solution (Conductor Searchlight).  Can the SOAP API be used to do this?  If so, what call would be used and can it set the SFDC Type to "Contact" and associate the new lead with an existing Account?
Tags (1)
7 REPLIES 7
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

You can use SOAP API syncLead or syncMultipleLeads functions to insert or update (upsert) lead records in Marketo. When updating an existing lead, the lead can be identified by Marketo ID, Marketo Cookie or Email.
 
If any of these attributes are set as a part of the input parameter and if there is a matching lead in Marketo with these values, the existing lead record will be updated instead of created. Passing the Marketo cookie id as an input parameter helps in associating the new lead with existing anonymous activity records. 
 
When Marketo workspaces are enabled and the header is used, the following rules are applied:
 
- New leads are created in the primary partition of the named workspace.
- Leads matched by the Marketo Lead ID, a foreign system ID, or a Marketo cookie, must exist in the primary partition of the named workspace, otherwise an error will be returned.
- If an existing lead is matched by email, the named workspace is ignored and the lead is updated in its current partition.
 
syncMultipleLeads allows to turn off the dedup feature. If dedupEnabled is set to true and no other unique identifier is given (foreignSysPersonId or Marketo lead Id), then the lead record will be de-duplicated using the email address. Keep in mind, passing in 'false' will create duplicates within Marketo. 
 
I tend to use syncMultipleLeads regardless I am sending one or many, making the API call more portable.
 
The skeleton is :
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mkt="http://www.marketo.com/mktows/">
   <soapenv:Header>
      <mkt:AuthenticationHeader>
         <mktowsUserId>?</mktowsUserId>
         <requestSignature>?</requestSignature>
         <requestTimestamp>?</requestTimestamp>
         <!--Optional:-->
         <audit>?</audit>
         <!--Optional:-->
         <mode>?</mode>
      </mkt:AuthenticationHeader>
   </soapenv:Header>
   <soapenv:Body>
      <mkt:paramsSyncMultipleLeads>
         <leadRecordList>
            <!--Zero or more repetitions:-->
            <leadRecord>
               <!--Optional:-->
               <Id>?</Id>
               <!--Optional:-->
               <Email>?</Email>
               <!--Optional:-->
               <ForeignSysPersonId>?</ForeignSysPersonId>
               <!--Optional:-->
               <ForeignSysType>?</ForeignSysType>
               <!--Optional:-->
               <leadAttributeList>
                  <!--Zero or more repetitions:-->
                  <attribute>
                     <attrName>?</attrName>
                     <!--Optional:-->
                     <attrType>?</attrType>
                     <attrValue>?</attrValue>
                  </attribute>
               </leadAttributeList>
            </leadRecord>
         </leadRecordList>
         <!--Optional:-->
         <dedupEnabled>?</dedupEnabled>
      </mkt:paramsSyncMultipleLeads>
   </soapenv:Body>
</soapenv:Envelope>
 
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

Thanks Breno - this is awesome! 

Is there a document on the API and all of its calls in addition to the individual help articles in the Community?

When we create a lead using the syncMultipleLeads call with <Email>?</Email> as the match key,  can we use attributes to set the SFDC Type to "Contact" and the SFDC Accoun Num to the ID of an existing SFDC Account with the result that a new Contact record will be created under the specified Account?  If so, how would we use the <attrName>,  <attrType> and <attrValue> attributes to do this?

Also, what if there is an existing SFDC Lead record, and we set the SFDC Type to "Contact" and the SFDC Accoun Num to the ID of an existing SFDC Account - will the Lead be converted to a Contact or would we need to do some additional processing to accomplish this?



Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

The soap api pdf guide cane be found here https://community.marketo.com/resource/MarketoSOAPAPI
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

Ah, that's great - thanks Cathal! 

I'll be providing this to our developers, but I'd like to know the answer to the following before I do.

When we create a lead using the syncMultipleLeads call with <Email>?</Email> as the match key,   can we use attributes to set the SFDC Type to "Contact" and the SFDC Accoun Num to the ID of an existing SFDC Account with the result that a new Contact record will be created under the specified Account?  If so, how would we use the <attrName>,  <attrType> and <attrValue> attributes to do this?

Also, what if there is an existing SFDC Lead record, and we set the SFDC Type to "Contact" and the SFDC Accoun Num to the ID of an existing SFDC Account - will the Lead be converted to a Contact or would we need to do some additional processing to accomplish this?
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

Elliott,
You cannot set the SFDC type over APIs.  To achieve this, you have to create a campaign which calls the SFDC "Convert Lead" flow action and request the campaign after the lead is sync-ed

Raj
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

Raj, the Marketo Convert Lead flow action is unsuitable in this use case (and most use cases) because it will create a new (duplicate) Account.  We need to creat a new Contact record that is associated with an existing Account.  Currently we are exporting new users added to Searchlight then batch upserting them as new Contacts to the matching account.  This technique is labor intensive and error prone.  It would be great if we could find an easier way to get them into Salesforce / Marketo.
Anonymous
Not applicable

Re: Can the SOAP API be used to add a new lead to Marketo?

Use the SFDC API to create your Contact/Account in SFDC with proper ID's and then let the native sync push to Marketo (assuming you are natively synced to SFDC).