Send an email from template
To send an email from a prepared template, set the template parameter to the template name.
To create a new email template, open the Emails section in Encharge and click the + icon in the lower-left. You can skip this step if you've already created your email template.
If you have previously created the recipient in Encharge, you can use personalization tags, for example {{ person.firstName }} in your email's text. See what fields you can use in Person Fields.
1
const axios = require('axios');
2
3
// Send a POST request
4
axios({
5
method: 'post',
6
url: 'https://api.encharge.io/v1/emails/send?token=yourAPIKey',
7
data: {
9
"template": "Welcome Email",
10
/**
11
* Optionally, you can include a dictionary of fields to be replaced.
12
* For example, passing
13
* `{ "loginURL": "https://app.encharge.io/login/3n2l3ad99"}`
14
* will replace
15
* `{{ loginURL }}` in the email template.
16
*/
17
"templateProperties": {
18
"loginURL": "https://app.encharge.io/login/3n2l3ad99"
19
}
20
}
21
});
Copied!
If you provide the from parameter, it will overwrite the sender address specified in the template.
To use the template ID instead of the template name, pass a number to the template parameter above. Finding the template ID is easy - open the template in the Encharge app. Look at the URL to find the email ID. In the following URL https://app.encharge.io/emails?email=123, the template ID is 123.
Last modified 4mo ago
Copy link