We're building a Custom Activity that will send a push message to a external platform from Journey Builder. In usage of the Journey, a Emailactivity will update the Entry Event data extension, adding a vouchercode.
We need to retrieve this updated(!) vouchercode in our custom activity, retrieving the voucher that was claimed in the previous mail form the updated Entry Event data extension
Databinding {{Event.my-entry-event.Vouchercode}}
seems not an option here, as it will only use the Entry event fields as they were at the time of entrying the Journey. Also, adding the dataextensions of the entry event(s) to the Data Model will become messy {{Contact.Attributes.My-DE.Vouchercode}}
, so the client preferred not to depend on that.
We now try to retrieve the updated data by the SFMC REST API on the /execute endoint, but that will cause a lot of external API requests, esspecially if they need to retrieve Bearer tokens first. e.g. for each customer /execute:
//Retrieve token
thenrequest('POST',
`https://${process.env.SFMC_SUBDOMAIN}.auth.marketingcloudapis.com/v2/token/`, {
json: sfmc_auth_req
})
.getBody('utf8')
.then(JSON.parse).done(function (res) {
token = res.access_token;
//Retrieve updated data from entry event data extension
thenrequest('GET', `https://${process.env.SFMC_SUBDOMAIN}.rest.marketingcloudapis.com/data/v1/customobjectdata/key/${dename}/rowset?$filter=guid%20eq%20'${requestObject.guid}'`, {
headers: {
'Authorization': 'Bearer ' + token
}
})
.getBody('utf8').then(JSON.parse).done(function (res) {
//Replace attributes with updated attributes as received from API
for (var key in res.items[0].values) requestObject[key] = res.items[0].values[key];
//post requestobject to external PUSH MESSAGE API
});
});
Question: Isn't there a way that you can make direct lookups in a Dataextension from a Custom Activity without the use of the REST api, or otherwise at least skip the Token retrieval process for each user as I assume the system must have a token available when running through the activity?
It seems like such a simple problem, retrieving the updated(!) data from the entry event, so probably i'm overlooking something.
According to the link below it seems that Databinding fields are updated on Publish and every hour. Is this really true? (I'm running an experiment now. UPDATE: that's not the case, Atrributes remain 'as they were' on entering the Journey and will not get updated after entering the Journey.)
Event Context You can reference an event within an expression (the incoming data associated with the entry event). Adhere to the {{Event.my-custom-product-entry-event-key.ProductId}} Evaluating Expressions An activity can ..etc... When processing a contact in a journey, the engine evaluates all expressions. Once a journey publishes, and every subsequent hour, the system compiles each expression to ensure evaluation at runtime.
Hope someone can give me some advice on how to deal with this issue.