We have created a email and for which the content is populated from a external source and we are using API callouts.The response from the API callout is very huge JSON output which comes around 5000 lines. I am familiar with AMP script and SSJS however since the JSON is big i prefer using SSJS which is very simple. So my question is if we use SSJS in email templates is there any drawbacks? And some times the response from API takes longer and which causes the delay in email deliveries.So is there any guidelines when using API callouts in emails?
1 Answer
I would recommend moving the SSJS call to a script activity and have it populate a Data Extension. Then send the email using AMPScript Lookup() on the DE or AttributeValue() functions to get the info you need in the email.
SSJS by itself is super slow in emails, add in API calls (especially with a large payload) and you are looking at super slow send times with the likelihood of timing out.
-
Hi Thanks for your response.Actually i am planning to parse all the response in the SCRIPT activity and also adding the design elements.But i am not storing the response in DE instead i store them in a content area and pull that in email through AMP script Commented Jan 20, 2018 at 5:36
-
And one of the problem in using AMP script is my API callout is a GET method and it has some headers to be set. But in AMP HTTP GET we can't set the HTTP headers.developer.salesforce.com/docs/… Commented Jan 20, 2018 at 5:42