I have a journey Where in user will enter 2 of the same custom activities
Happening Right Now
User enters custom activity 1 and sends product information to a webservice to get a product quotation now during the waiting period, the product information was updated manually or through api, Now users enter custom activity 2, even though the product information was updated in the waiting period. It still sends the old product information to the webservice thus receiving an old quotation.
Correct Scenario
User enters custom activity 1 and sends product information to a webservice to get a product quotation now during the waiting period, the product information was updated, the product information update can either be done manually or through api. Now once the user enters custom activity 2 it sends the updated product information to a webservice to receive an updated quotation.
What i need is to be able to get the updated information of the user in the journey.
I use parseEventSchema to get the columns of the data extension and use payload to pass the bindings to my inarguments in my config.json.
Now in my execute function, I can get the data of the user that entered the journey.
Sample Data Extension Column
PrimaryKey
CampaignMemberId
Product Name
Product Quantity
Product Group
This is what my execute method in custom activity looks like
console.log("EXECUTE HAS BEEN RUN");
JWT(req.body, process.env.JWT_KEY, (err, decoded) => {
// verification error -> unauthorized request
if (err) {
console.error(err);
return res.status(401).end();
}
if (decoded && decoded.inArguments && decoded.inArguments.length > 0) {[]
//Use fields in decoded.inarguments to create a request body
//use node.js to do webservice
//decoded args contains the data to get the token and do a marketing
//cloud rest api call
var bodyStringAdvertising = JSON.stringify({
//Sample body
})
var headersAdvertising = {
//Sample header
}
var optionsAdvertising = {
method: 'POST',
headers: headersAdvertising,
url: '//Sample URL'
};
request(optionsAdvertising, function (error, response, body) {
if (error) throw new Error(error);
console.log('response body',body);
//Once I get the response, I'm going to use some of the values to update
a row in a Data Extension
//How Can I do that
}).write(bodyStringAdvertising);
} else {
console.error('inArguments invalid.');
return res.status(400).end();
}
});
console.log("end execute function!!!");