Skip to content

Triggered email plugin

Use the triggered email plugin to work with the metadata of triggered emails and email fragments. The metadata is stored in the common/metadata/triggeredEmail.json file. You can update the file location and filename in the metadata and emailsManifest properties in ./.ewizard/settings.json. For more information, see Triggered emails.

To access the plugin, use the methods in the browser console in eWizard Editor.

The email or fragment must include the triggeredEmail.json file for correct plugin operation.

Use this context to access the plugin and its methods:

js
window.ewizardjs.triggeredEmail

Use the following methods to add, update, or get the triggeredEmail.json data.

getEmailById

Use the getEmailById method to get the data from the emails field of the triggeredEmail.json file. Use the email ID to get the data.

js
window.ewizardjs.triggeredEmail.getEmailById(emailId)

The getEmailById method has the following parameters:

getFragmentById

Use the getFragmentById method to get the data from the fragments field of the triggeredEmail.json file. Use the email fragment ID to get the data.

js
window.ewizardjs.triggeredEmail.getFragmentById(fragmentId)

The getFragmentById method has the following parameters:

ParameterTypeDescription
fragmentIdStringThe fragment ID. This is a required parameter.

getEmailsJson

Use the getEmailsJson method to return all the emails and fragments from the triggeredEmail.json file of your e-Detailer project.

js
window.ewizardjs.triggeredEmail.getEmailsJson()

The getEmailsJson method has no parameters.

addEmail

The addEmail method adds an email ID and other metadata fields such as name or url to the emails object in the triggeredEmail.json file.

js
window.ewizardjs.triggeredEmail.addEmail(id, data)

The addEmail method has the following parameters:

ParameterTypeDescription
idStringThe email ID. This is a required parameter.
dataObjectThe email metadata. Use the parameter to add any metadata fields to the specific email. This is an optional parameter.

addFragment

The addFragment method adds an email fragment ID and other metadata fields such as name or url to the fragments object in the triggeredEmail.json file.

js
window.ewizardjs.triggeredEmail.addFragment(id, data)

The addFragment method has the following parameters:

ParameterTypeDescription
idStringThe email fragment ID. This is a required parameter.
dataObjectThe email fragment metadata. Use the parameter to add any metadata fields to the specific email fragment. This is an optional parameter.

updateEmail

Use this method to update the email metadata in the triggeredEmail.json file. Enter the ID of the email to update the metadata in it.

js
window.ewizardjs.triggeredEmail.updateEmail(id, data)

The updateEmail method has the following parameters:

ParameterTypeDescription
idStringThe ID of the email you want to update. This is a required parameter.
dataObjectThe metadata fields of the email you want to update. This is a required parameter.

updateFragment

Use this method to update the email fragment metadata fields in the triggeredEmail.json file. Enter the ID of the email fragment to update the metadata in it.

js
window.ewizardjs.triggeredEmail.updateFragment(id, data)

The updateFragment method has the following parameters:

ParameterTypeDescription
idStringThe ID of the email fragment. This is a required parameter.
dataObjectThe metadata fields of the email fragment. This is a required parameter.