0

Is it possible to inject a contact into a Marketing cloud journey based on an event in SalesCloud?

Say I have an object in Sales-Cloud & when a new record is created I would like to enter this contact into a journey in Marketing Cloud.

I know it's possible to do a triggered send via the marketing cloud connector, but I would like the contact to enter a journey. Is this possible?

3

It is indeed possible and very simple. You should use Salesforce Data Event in Journey Builder:

A Salesforce Data Event is an action in Sales or Service Clouds, such as creating or updating an object record, injects a contact into a journey. When the primary object meets rule criteria and reference object filtering criteria, Salesforce Flows initiate a Journey Builder event.

You can "listen" to creation and changes of a Contact record, and inject it directly. You can also "listen" to related records, e.g. inject a contact once a Case created for that individual is set to Closed.

When using the Sales or Service Cloud object as the source of the entry event, you define following:

  • Who enters the journey, such as users, leads, or contacts
  • When the user, lead, or contact enters the journey, such as when a record is created or updated
  • Select attributes from object data to filter who enters the journey
  • Select fields from related objects and the entry object to use for journey data
2

You can also use the API entry. But NOTE that you may need to custom code few things in Sales cloud, compared to the SALESFORCE Data entry source method.

Sales/Service cloud:

By using Future class, pass the parameters to the Marketing cloud's Landing page. Make sure to include the 18-digit Contact/Lead ID.

Marketing cloud Fire Entry to Journey

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/postEvent.htm

Example cloudpage code:

<!-- Processing page : START -->
%%[
SET @subkey = QueryParameter('subkey')
SET @FirstName = QueryParameter('FirstName')
SET @email = QueryParameter('email')
   /*Generating the AccessToken using client id and secret key*/
   VAR @callstatus, @response
   SET @payload = '{"client_id": "xxxxxx", "client_secret": "xxxxxxx", "grant_type": "client_credentials"}'
   SET @accessToken = HTTPPost2("https://xxxxxxxxxxxx.auth.marketingcloudapis.com/v2/token", "application/json", @payload, True, @callstatus, @response)
   ]%% 
   <script runat="server">
   /*Framing the API content and extracting only access token from the above response*/
   Platform.Load("core", "1");
   var subkey = Variable.GetValue("@subkey");
   var FirstName = Variable.GetValue("@FirstName");
   var email = Variable.GetValue("@email");
   var accessTok = Variable.GetValue("@callstatus");
   var response_ = Platform.Function.ParseJSON(accessTok);
   var accessToken_ = response_.access_token;
   var content = { "ContactKey": subkey, 
       "EventDefinitionKey":"xxxxxxx", 
       "EstablishContactKey": true, 
       "Data": { 
          "email address": email,
          "FirstName":FirstName,
          "Contact Key":subkey }}
   var strContent = Platform.Function.Stringify(content);
   Variable.SetValue("@token_",'Bearer '+accessToken_); 
   Variable.SetValue("@content",strContent);
   </script>
   %%[
   /*Invoking the journey API*/
   var @statusCode
   var @response
   SET @post = HTTPPost2("https://xxxxxxxxxx.rest.marketingcloudapis.com/interaction/v1/events","application/json",@content,false,@statusCode, @response, "Authorization", @token_)
 ]%%
 %%=v(@token_)=%% <br/>
 %%=v(@statusCode)=%% <br/>
 %%=v(@content)=%%<br/>
<!-- LIVE:: Processing page : END -->
  • Out of curiosity - what is the advantage of the custom API route, compared with the Salesforce Data Entry Event? – Lukas Lunow Dec 3 '19 at 11:03
  • Hi @LukasLunow thanks for checking... I too agree that if the scenario is a simple event like "When a new record is created", then I suggest to go with Salesforce Data Entry... But I would suggest the above method if the LOGIC to enter journey CAN ONLY / ALREADY CONFIGURED in Sales cloud (in APEX)........ To give a example: I personally preferred above method over Salesforce Data Entry, where in we need to inject those newly created CONTACTS who MEET certain business requirements, and NOT every new CONTACTS! ....... Please share your thoughts on this! – Vishal Kumar C V Dec 3 '19 at 13:13
  • 1
    The API route does allow for more custom options that may not be met by the data entry event, but it also requires a much more significant lift and additional requirements to get up and running. I appreciate you adding it in here for others to reference though in case the data entry event does not work for them. – Gortonington Dec 3 '19 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.