docs
  1. SCAYLE Resource Center
  2. Developer Guides
  3. Shops
  4. Emails

Emails

SCAYLE offers you the capability to manage your Mail Templates in a efficient & documented way.

Learn how to use the Admin API to manage redirects below, and refer to the User Guide for instructions on setting up mail templates in the SCAYLE Panel.

Admin API

Create Email Key

This method allows to create a new email key.

const response = await adminApi.apis.Emails.createEmailKey({shopKey, countryCode}, {requestBody: emailKey});
const emailKey = response.body;

Example

const emailKey = {
  "key": "subscription-order-created-email",
  "name": "Subscription Order created email",
};

const response = await client.apis.Emails.createEmailKey({shopKey: "ms", countryCode: "DEU"}, {requestBody: emailKey});
const createdEmailKey = response.body

Update Email Key

This method allows to update an email key.

const response = await adminApi.apis.Emails.updateEmailKey({shopKey, countryCode, emailKeyId}, {requestBody: emailKey});
const emailKey = response.body;

Example

const emailKey = {
  "name": "Subscription Order created email",
};

const response = await client.apis.Emails.updateEmailKey({shopKey: "ms", countryCode: "DEU", emailKeyId: 123}, {requestBody: emailKey});
const updatedEmailKey = response.body;

Delete Email Key

This method allows to delete an email key.

await adminApi.apis.Emails.deleteEmailKey({shopKey, countryCode, emailKeyId});

Example

await client.apis.Emails.deleteEmailKey({shopKey: "ms", countryCode: "DEU", emailKeyId: 123});

Get Email Key

This method allows to get an email key.

const respose = await adminApi.apis.Emails.getEmailKey({shopKey, countryCode, emailKeyId});
const emailKey = response.body;

Example

const response = await client.apis.Emails.getEmailKey({shopKey: "ms", countryCode: "DEU", emailKeyId: 123});
const emailKey = response.body;

Get Email Keys Collection

This method allows to get an email key collection.

const respose = await adminApi.apis.Emails.getEmailKeys({shopKey, countryCode});
const emailKeys = response.body.entities;

Example

const response = await adminApi.apis.Emails.getEmailKeys({
    "shopKey": "ms",
    "countryCode": "DEU",
    "cursor": "Mgo=",
});

const emailKeys = response.body.entities;

Send Email

This method allows to trigger an email.

await adminApi.apis.Emails.sendEmail({shopKey, countryCode}, {requestBody: email});

Example

const email = {
  "key": "subscription-order-created-email",
  "recipient": "[email protected]",
  "payload": {
    "property1": "value1",
    "property2": "value2",
  },
  "orderId": 123
};

await client.apis.Emails.sendEmail({shopKey: "ms", countryCode: "DEU"}, {requestBody: email});