Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
SampleHelper, ConfigurationObjectClient refactor
Browse files Browse the repository at this point in the history
- Modified the email asset views
- Removed the DELETE email send definition example
from the ConfigurationObjectClient sample because it was
generally executed faster than the status change from
queued email to sent email, thus email not getting sent
  • Loading branch information
sfcbetiuc committed Oct 30, 2019
1 parent a81b36a commit 289e89d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
6 changes: 1 addition & 5 deletions test/samples/ConfigurationObjectClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,5 @@ const SalesforceMarketingCloud = require('../../src');

// Get the send status of the email send:
let recipientSendStatus = await transactionalMessagingApi.getEmailSendStatusForRecipient(messageKey);
console.log('send status for recipient: ' + JSON.stringify(recipientSendStatus));

// Delete email send definition:
let deleteEmailDefinitionResult = await transactionalMessagingApi.deleteEmailDefinition(createEmailDefinitionResult.definitionKey);
console.log('deleteEmailDefinitionResult: ' + JSON.stringify(deleteEmailDefinitionResult));
console.log('recipientSendStatus: ' + JSON.stringify(recipientSendStatus));
})();
27 changes: 18 additions & 9 deletions test/samples/SampleHelper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const Asset = require('../../src/Model/Asset');
const AssetType = require('../../src/Model/AssetType');
const SalesforceMarketingCloud = require('../../src');

class SampleHelper {
Expand All @@ -10,17 +8,28 @@ class SampleHelper {

const HTML_EMAIL_ASSET_TYPE_ID = 208;
const ASSET_TYPE_NAME = 'htmlemail';
let assetType = new AssetType(HTML_EMAIL_ASSET_TYPE_ID, ASSET_TYPE_NAME);
let assetType = new SalesforceMarketingCloud.AssetType(HTML_EMAIL_ASSET_TYPE_ID, ASSET_TYPE_NAME);

let asset = new Asset(customerKey, assetType, assetName, assetDescription);

/* An email asset has to have at least these minimal
properties set in order for the send definition to become active*/
let asset = new SalesforceMarketingCloud.Asset(customerKey, assetType, assetName, assetDescription);

asset.views = {
'subjectline': {
'content': 'New TS Subject Line'
}
'content': 'Email generated from the Node.js SDK'
},
"html": {
"content": "<!DOCTYPE html>\n" +
"<html lang=\"en\">\n" +
"<head>\n" +
" <meta charset=\"UTF-8\">\n" +
" <title>Welcome to SFMC Transactional Messaging</title>\n" +
"</head>\n" +
"<body>\n" +
" <img src=\"https://image.slidesharecdn.com/scalingdevelopereffortswithsalesforcemarketingcloudpptxv4-180803183610/95/scaling-developer-efforts-with-salesforce-marketing-cloud-31-638.jpg?cb=1533321419\"\n" +
" alt=\"Let's Talk TM image\">\n" +
"</body>\n" +
"\n" +
"</html>"
},
};
return asset;
}
Expand Down

0 comments on commit 289e89d

Please sign in to comment.