Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HubSpotHanevold/bf1e8e865d4be52099c0b3d37eaf7f35 to your computer and use it in GitHub Desktop.
Save HubSpotHanevold/bf1e8e865d4be52099c0b3d37eaf7f35 to your computer and use it in GitHub Desktop.
Retrieving an email template from HubSpot to do a find and replace on the full body.
let cloneId = inputData.cloneId;
let token = inputData.token;
let auth = 'Bearer ' + token;
fetch('https://api.hubapi.com/marketing-emails/v1/emails/'+ cloneId , {
headers: {authorization: auth}
})
.then(function(res) {
return res.text();
})
.then(function(body) {
var output = {id: 1, rawHTML: body};
callback(null, output);
})
.catch(callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment