EmailTemplatesManager

management. EmailTemplatesManager

EmailTemplatesManager This class provides a simple abstraction for performing CRUD operations on Auth0's Email Templates. {@see https://auth0.com/docs/api/management/v2#!/Email_Templates/get_email_templates_by_templateName}

Constructor

new EmailTemplatesManager(options)

Source:
Parameters:
Name Type Description
options Object

The client options.

Name Type Attributes Description
baseUrl String

The URL of the API.

headers Object <optional>

Headers to be included in all requests.

retry Object <optional>

Retry Policy Config

Members

(inner) auth0RestClient :external:RestClient

Provides an abstraction layer for performing CRUD operations on Auth0's Email Templates.

Source:
Type:

(inner) clientOptions :Object

Options object for the Rest Client instance.

Source:
Type:
  • Object

Methods

create(data, cbopt) → {Promise|undefined}

Create a new Email Template.

Source:
Parameters:
Name Type Attributes Description
data Object

Email Template data object.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.emailTemplates.create(data, function (err) {
  if (err) {
    // Handle error.
  }

  // Email Template created.
});

get(params, cbopt) → {Promise|undefined}

Get an Auth0 Email Template.

Source:
Parameters:
Name Type Attributes Description
params Object

Email Template parameters.

Name Type Description
name String

Template Name

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
management.emailTemplates.get({ name: EMAIL_TEMPLATE_NAME }, function (err, emailTemplate) {
  if (err) {
    // Handle error.
  }

  console.log(emailTemplate);
});

update(params, data, cbopt) → {Promise|undefined}

Update an existing Email Template.

Source:
Parameters:
Name Type Attributes Description
params Object

Email Template parameters.

Name Type Description
name String

Template Name

data Object

Updated Email Template data.

cb function <optional>

Callback function.

Returns:
Type:
Promise | undefined
Example
var data = { from: 'new@email.com' };
var params = { name: EMAIL_TEMPLATE_NAME };

management.emailTemplates.update(params, data, function (err, emailTemplate) {
  if (err) {
    // Handle error.
  }

  console.log(emailTemplate.from);  // 'new@email.com'
});