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) {
HerokuPoster.doPost(JSON.serialize(Trigger.new));
public class HerokuPoster {
@future(callout=true)
public static void doPost(String sobjectsJson){
HttpRequest req = new HttpRequest();
req.setMethod('POST');
req.setEndpoint('https://x.herokuapp.com/trigger');
req.setBody(sobjectsJson);
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?