4

We are using Salesforce and Marketing cloud to process data, create a campaign, populate a template and send emails. Pretty much as you'd expect. Separately, we have an internal system that is connected to an app that our users use to access their details. This system doesn't have the capability to send emails in the same format as Salesforce/SFMC (it doesn't matter if Salesforce or Marketing Cloud sends the email).

The Plan: we are going to create the email in SFMC but not send it. Then push/pull that email, with all fields populated, to our internal system. The receiving station can display emails in the format that SFDC/SFMC would create but cannot create emails in that format. We cannot send health related information in the emails to the recipient but we can through the app which has a gateway to access. In summary: Salesforce makes pretty emails, our app can display personal information which cannot be included in an email. We want to send pretty emails to recipients that have calls to action based on their personal information.

Research: I have been doing a little research looking through the SFMC API documentation and especially this: SFMC API Documentation|Email to work out if this is possible.

The Push vs Pull argument would be better if PUSH was the solution but I am unsure if the receiving system can accept the push. I am making the assumption that it can.

Questions:

  • Can we generate the email and not send it? In a class, in SFDC?
  • APIs:
    • Can we push the email to the other system in a SOAP API call?
    • Can we move the email to the other system in a REST API call?
    • Which is the better approach? My assumption is that a RESTful call may not handle the size of the data in an email - am I wrong?
  • What form does the data in the email take?
    • BLOb?
    • xsd:string is listed in the documentation but what about images etc?

I don't have a developer on my team right now so some of this may seem basic API but please forgive me my lack of knowledge.

  • 2
    This sounds like a complicated solution to an unspecified problem. Could you tell us what you're trying to achieve? meta.stackexchange.com/questions/66377/what-is-the-xy-problem – identigral May 22 at 20:50
  • @identigral In summary: Salesforce makes pretty emails, our app can display personal information which cannot be included in an email. We want to send pretty emails to recipients that have calls to action based on their personal information. – SeanGorman May 23 at 18:07
  • 2
    Can you be more specific? I am wondering if Field Level Encryption might help you. It stores sensitive data in an encrypted format in Marketing Cloud, and decrypts it at send-time. – Lukas Lunow May 23 at 19:47
  • No - the email that is sent cannot contain the data. If we send a message into the gated app then the data can be sent. The app can display html but doesn't have the ability to generate a decent looking marketing 'email'. – SeanGorman May 23 at 20:09
  • 1
    If your issue is that you don't want certain PII data stored in the SFMC system, you can set these up as triggered sends and don't create fields for the info you don't want stored in the Triggered Send DE. They will let the data be included in the send, as it collects the data from the call, but the data will not be stored in the DE in SFMC since the fields are not there. This makes sure it is sent, but not stored anywhere that ANY user will have access to. – Gortonington May 24 at 20:00
4
+100

You can grab rendered HTML content from SFMC, but in order to render it, the information needs to be inside the platform. Which I believe is something you do not want.

Sample call:

Host: https://www.exacttargetapis.com
POST /guide/v1/emails/[emailID here]/dataExtension/key:[DE External Key goes here]/contacts/key:[Subscriber Key that you want to preview here]/preview?kind=html
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

Another option if PII being stored and accessed in a 3rd party system is not an option is to obfuscate the data via a service like Field Level Encryption or similar encryption on the data inside the system.

If the data can in no way be stored in the system, but the email can be sent out - I would look at utilizing an External Content Area to call to a hosted service on your other system that will create the Health Care PII inside that service and render it at send time. This would make sure the data and processing of it remain in your secure area and not in SFMC.

Another option is to have each email be a Triggered Send Definition. You would have your secure service make an API call to the TSD endpoint with the data and external key of the Trigger you are looking for. You would then want to make sure that you do not include any of the fields in the data passed in the API call that are PII so the system will not store it.

For example:

If you pass a payload like: {Subscriberkey: "me@me.com", EmailAddress: "me@me.com", FirstName: "Gor", Medicine: "tegretol 200mg"} but only have FirstName inside the DE (automatically includes SubscriberKey and EmailAddress), the Medicine data in the payload will not be stored in the system. It will only be used for rendering the email and then disappear into the nether.


Outside of those, I honestly don't think SFMC is your solution. I would look at email creation services to build you emails and store them in your app and have it operate 100% externally from your SFMC marketing campaigns. Or you can include some markup languages (like MJML, Inky, etc.) inside your service to create the emails.

I honestly would say that I would highly recommend sending the emails from SFMC if possible instead of through your other service. By sending from another service, you run risk on deliverability (as all the SPF, DMARC, etc that you get with SFMC will not apply in your app) and with the suffer in deliverability, you could actually also hurt your SFMC domain reputation.

  • thank you @Gortonington Do you think SFDC or SFMC is best for this? If I don't need a journey I am thinking a simple SFDC thing... If we add complication then SFMC is best - thoughts? – SeanGorman May 29 at 13:36
  • I am not as knowledgeable in SFDC, but I think it will still run into the same issues of how to take the HTML and variables and fill them with info not stored in the system where the email is stored. Your best bet is to have a custom sort of 'rendering engine' for your app on custom template html that will fill in the info and provide a full 'final' HTML file. This can then be used either in your app to the mail client, or sent inside of an API call to SFMC or SFDC to send it out. – Gortonington May 29 at 15:22
1

It is possible to generate the email in APEX and not send it using renderStoredEmailTemplate method on the Messaging class.

This will allow you to specify the Email Template Id as well as the objects where you need to populate the merge fields from and will return the HTML Body as a string. Since it is a string, you can push it to your system either via REST or SOAP (I am not sure about the size limitations though). If your emails may contain attachments, then that might be challenging.

  • going to test this. – SeanGorman May 23 at 18:53
  • I believe in this question, the Email would be stored in SFMC, which uses different API than SFDC. – Gortonington May 25 at 19:15
1

Another potential solution is to create a Custom Activity. This custom activity would allow you to post information from a contact in a Journey into your internal system. Marketing Cloud allows you to get the HTML of an email without rendered replace tokens/ampscript/ssjs -- in the case of simple replace tokens, you could easily find the un mapped tokens using a regex in the html content, replace them with information from your internal system, then send an email from your internal system that contains the updated html.

To further elaborate without going into too much technical detail,

The endpoints defined in this custom activity will allow you both communicate to your internal system at the time of configuration and notify you when a contact enters the activity within a Journey.

At the time of configuration in the Journey, the communication to your internal system will contain information about the configuration, ie the Journey Ids, Keys, etc., any DEs it uses, and a host of other Marketing Cloud. You would want to store whatever you need about this Journey in your internal system at the time of configuration so that when a call is made to your internal system at the time a contact enters the activity, you know how to retrieve the correct email, Marketing Cloud information, whatever.

When the notify call is made into your internal system at the time a contact enters the custom activity, you could then make whatever Api calls into Marketing Cloud, using the information you stored at the time of configuration, needed to retrieve information you need about the contact, the html for the desired email, etc.

Once you had all the information you need from SFMC - email HTML, Contact info - you could then update the email HTML with your PII and send an email containing that updated HTML content.

Downside to this approach compared to those others suggested is that you are going to need to create a new application on your internal systems to handle the calls needed for the custom activity, make the necessary Api calls into Marketing Cloud to retrieve data, and to process the data to send an email from whatever system you use internal. Development time is potential significant, especially in comparison to using out-of-the-box Marketing Cloud functionality.

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.