You can create emails or email fragments from e-Detailer slides.
The common/metadata/triggeredEmail.json
file stores the info about triggered emails. Add the file and the directory manually to use triggered emails. You can update the file location and filename in the metadata
and emailsManifest
properties in the ./.ewizard/settings.json
file:
// ./.ewizard/settings.json
{
"path": {
"metadata": "common/metadata",
"emailsManifest": "common/metadata/triggeredEmail.json"
}
}
}
You can modify the file manually or with the Triggered email API.
Example of the triggeredEmail.json
file:
// ./common/metadata/triggeredEmail.json
{
"emails": {
"email1": {
"name":"Email 1",
}
},
"fragments": {
"fragment1": {
"name":"Fragment 1",
}
}
}
Each email and fragment has an id
and data
fields. For example, email1
and fragment1
are the id
fields, and name
is the data
of the email and fragment respectively.
The emails
object includes the triggered emails:
• email1
is the triggered email ID for eWizard Editor. It's an object that includes other metadata fields, like name
—the email name. For example, Email 1
.
The fragments
is the object that includes the email fragments:
• fragment1
is the email fragment ID for eWizard Editor. It's an object that includes other metadata fields, like name
—the fragment name. For example, Fragment 1
.
Triggered email API usage examples
You can use the triggered email API methods to edit the triggeredEmails.json
file.
addEmail
window.ewizardjs.triggeredEmail.addEmail('testemail1', {name: 'Test_email_1', url: 'https://viseven.com'})
• id
is the email ID. For example, testemail1
.
• data
is the object that includes the email metadata fields:
— name
is the email name string. For example, Test_email_1
.
— url
is the email URL address string. For example, https://viseven.com
.
As a result, this API method adds the following email metadata to the emails
field:
// common/metadata/triggeredEmail.json
{
"emails": {
"testemail1": {
"name": "Test_email_1",
"url": "https://viseven.com"
}
},
}
addFragment
window.ewizardjs.triggeredEmail.addFragment('testfragment1', {name: 'Test_fragment_1', url: 'https://viseven.com'})
• id
is the email ID. For example, testfragment1
.
• data
is the object that includes the email fragment metadata fields:
— name
is the email fragment name string. For example, Test_fragment_1
.
— url
is the email fragment URL address string. For example, https://viseven.com
.
As a result, this API method adds the following email fragment metadata to the fragments
field:
// common/metadata/triggeredEmail.json
{
"fragments": {
"testfragment1": {
"name": "Test_fragment_1",
"url": "https://viseven.com"
}
},
}
getEmailById
For example, the triggeredEmail.json
file has an email with the testemail1
ID, the name
and url
fields as data
:
// common/metadata/triggeredEmail.json
{
"emails": {
"testemail1":{
"name":"Test_email_1",
"url":"https://viseven.com"
}
},
}
To retrieve data
from the email with the testemail1
ID, run:
window.ewizardjs.triggeredEmail.getEmailById('testemail1')
As a result, you can see the following in your browser console:
name: "Test_email_1", url: "https://viseven.com"
getFragmentById
For example, the triggeredEmail.json
file has the email fragment with the testfragment1
ID, the name
and url
fields as data
:
// common/metadata/triggeredEmail.json
{
"fragments": {
"testfragment1": {
"name": "Test_fragment_1",
"url": "https://viseven.com"
}
},
}
To retrieve data
from the fragment with the testfragment1
ID, run:
window.ewizardjs.triggeredEmail.getFragmentById('testfragment1')
As a result, you can see the following in the browser console:
name: "Test_fragment_1", url: "https://viseven.com"
removeEmail
For example, the triggeredEmail.json
file has an email with the testemail1
ID, the name
and url
fields as data
:
// common/metadata/triggeredEmail.json
{
"emails": {
"testemail1":{
"name":"Test_email_1",
"url":"https://viseven.com"
}
},
}
To remove the email with the testemail1
ID and its metadata from the triggeredEmails.json
file, run:
window.ewizardjs.triggeredEmail.removeEmail('testemail1')
removeFragment
For example, the triggeredEmail.json
file has the email fragment with the testfragment1
ID, the name
and url
fields as data
:
// common/metadata/triggeredEmail.json
{
"fragments": {
"testfragment1": {
"name": "Test_fragment_1",
"url": "https://viseven.com"
}
},
}
To remove the email fragment with the testfragment1
ID and its metadata from the triggeredEmails.json
file, run:
window.ewizardjs.triggeredEmail.removeFragment('testfragment1')
updateEmail
For example, the triggeredEmail.json
file has an email with the testemail1
ID:
// common/metadata/triggeredEmail.json
{
"emails": {
"testemail1":{
"name":"Test_email_1"
}
},
}
To add the url
field to the email metadata, run:
window.ewizardjs.triggeredEmail.updateEmail('testemail1', {name: 'Test_email_1', url: 'https://viseven.com'})
The resulting testemail1
looks like this:
// common/metadata/triggeredEmail.json
{
"emails": {
"testemail1": {
"name": "Test_email_1",
"url": "https://viseven.com"
}
},
}
updateFragment
For example, the triggeredEmail.json
file has the email fragment with the testfragment1
ID:
// common/metadata/triggeredEmail.json
{
"fragments": {
"testfragment1": {
"name": "Test_fragment_1"
}
}
}
To add the url
field to the email fragment metadata, run:
window.ewizardjs.triggeredEmail.updateFragment('testfragment1', {name: 'Test_fragment_1', url: 'https://viseven.com'})
The resulting testfragment1
looks like this:
// common/metadata/triggeredEmail.json
{
"fragments": {
"testfragment1": {
"name": "Test_fragment_1",
"url": "https://viseven.com"
}
}
}