Expand my Community achievements bar.

SOLVED

How too Migrate Email Templates from an endpoint into Adobe campaign classic

Avatar

Level 4

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 ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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();

 


     Manoj
     Find me on LinkedIn

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

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();

 


     Manoj
     Find me on LinkedIn

Avatar

Level 8

But in which functionality can I use this JS code. Already in email creation template?

Avatar

Community Advisor

Hi @Michael_Soprano 

 

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