Hi Team,
We are exploring the possibility of migrating email templates, specifically the transactional type, from an external endpoint (GitHub/AWS) into Adobe Campaign Classic.
Any idea what could be the approach ?
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @abhinav99
I am assuming the external endpoint is returning a JSON object with all values required to create a template.
What you can do is read data from the endpoint and create template with some JS code.
How to read JSON data from an API:
var req = new HttpClientRequest("ENDPOINT")
req.header["Authorization"] = "Bearer " // if any auth is required
req.header["Content-Type"] = "application/json";
req.method = "GET";
try {
req.execute()
}
catch(e)
{
logError(e)
}
var response = req.response
var res=JSON.parse(response.body);
req.disconnect()
You will have the data in res and then you can fetch the data from any available attribute
Then create the transactional email delivery with JS Code:
var delivery = nms.delivery.create()
delivery.Duplicate("nms:delivery|3714"); // 3714 is the primarky key of default transactional template
delivery.eventType=eventType; // change this according to your variables
delivery.label = deliveryLabel; // change this according to your variables
delivery.content.html.source=deliveryHTMLContent; // change this according to your variables
delivery.content.text.source=delvieryTextContent; // change this according to your variables
delivery.save();
Hello @abhinav99
I am assuming the external endpoint is returning a JSON object with all values required to create a template.
What you can do is read data from the endpoint and create template with some JS code.
How to read JSON data from an API:
var req = new HttpClientRequest("ENDPOINT")
req.header["Authorization"] = "Bearer " // if any auth is required
req.header["Content-Type"] = "application/json";
req.method = "GET";
try {
req.execute()
}
catch(e)
{
logError(e)
}
var response = req.response
var res=JSON.parse(response.body);
req.disconnect()
You will have the data in res and then you can fetch the data from any available attribute
Then create the transactional email delivery with JS Code:
var delivery = nms.delivery.create()
delivery.Duplicate("nms:delivery|3714"); // 3714 is the primarky key of default transactional template
delivery.eventType=eventType; // change this according to your variables
delivery.label = deliveryLabel; // change this according to your variables
delivery.content.html.source=deliveryHTMLContent; // change this according to your variables
delivery.content.text.source=delvieryTextContent; // change this according to your variables
delivery.save();
But in which functionality can I use this JS code. Already in email creation template?
Views
Replies
Total Likes
In the workflow?
Views
Replies
Total Likes
You can write the above code in JS activity as well as the delivery advanced tab and call the delivery ID in the delivery template.
Regards
Akshay
Views
Likes
Replies