I am working on a proof of concept application using Heroku and multiple marketing cloud instances within different orgs.

We want to gain insight into the aggregate emails that have been sent out to contacts from other orgs.

I have created an application that sits on Heroku and has an endpoint waiting for a payload (Email Send Data). Once that data is received, it is sent into Apache Kafka and then there are consumer applications running that clean/normalize and put it into a postgresql database (within heroku).

We are going to create a rest api that will then provide this data back to any of the orgs that want to see what a contact has been sent.

On the surface, its straight-forward and we have proved some things out already.

My question is about receiving that send data from Marketing Cloud.

I am not too familiar with SF, but in some of my smaller tests working with SF data, I was able to create triggers that sent data out once it detected an insert.

Example with SF Data:

trigger FeedItemSendToHerokuTrigger on FeedItem (after insert) {


    public class HerokuPoster {
        public static void doPost(String sobjectsJson){
            HttpRequest req = new HttpRequest();
            req.setHeader('Content-Type', 'application/json');

            Http http = new Http();
            HttpResponse response = http.send(req);

Is there a way to do this within MC as well? My end goal here is to find out the best way to get emails that are sent out over to an API by posting the data to the endpoint.

Any suggestions on an approach to this?

1 Answer 1


I think rather than having Marketing Cloud push you the information, you are going to need to have your application pull the information. I do not know of any way to set up a trigger like this in Marketing Cloud -- I do not believe it possible, but someone else may know differently.

If you do not receive any suggestions on push this information to your application, the steps to pull the information would be as follows:

  1. Create an Installed Package in the org(s) giving yourself the necessary permissions to retrieve the needed data -- potentially read on Data Extension and Emails. If you are working in an org that has a parent and child business units, you can create this installed package in the parent for use in all. If not, you'll need installed packages in each of the Orgs. This Installed Package will give you the necessary permission to retrieve Auth tokens that will be needed in step 2 for making Api calls.

  2. Schedule some mechanism in your application to periodically make the necessary Api calls into Marketing Cloud in one of two ways to retrieve your desired data:

    a) Enable Send Logging on your Org(s) (this must be done through a support request). Create a SendLog DataExtension in the Org(s). Make SOAP calls into Marketing Cloud to retrieve DataExtensionObjects (essentially rows) from this DataExtension which are populated each time an email is sent.

    b) Use Marketing Cloud's Soap Api to retrieve SentEvents (along with ClickEvents, OpenEvents, etc. if you so desire) which are created each time an email is sent.

Unfortunately, I do not believe the information you desire is accessible via Marketing Cloud REST Api which means it will need to be retrieved using the SOAP Web Service.

Marketing Cloud does also have a reporting feature that allows for the pushing of reports to an FTP server. I am not at all familiar with this feature -- I do not know how it is set up, triggered (or whether automatic or schedule triggering is even possible), nor the format of this data in the files uploaded to the configured FTP. This may be something to look into as an alternative.

  • Thanks for this detailed answer! The API seems like it will be the way to go. I will just need to figure out how to keep track of what has been collected so that were not re-running it over the same data in the automation piece.
    – SBB
    Commented Jul 18, 2019 at 13:59
  • We are currently using Marking Cloud Connector to bring over the MC data into our Salesforce Org. I assume from that and the records were being added on the SF side, we could use something like Heroku Connect to just pull that data over into the postgres database from multiple orgs doing the same thing. Once it's in postgres, we can just create an API on top of it for the different orgs to pull in the data.
    – SBB
    Commented Jul 18, 2019 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .