Skip to content

Sending with a template

Sending emails through dynamic templates is one of the main uses of Waypoint. To send an email through a dynamic template, you can use the API call below. Within the call, you can pass data variables that are accessible from your template.

const axios = require('axios');
axios({
method: "post",
url: "https://live.waypointapi.com/v1/email_messages",
headers: {
"Content-Type": "application/json"
},
auth: {
username: API_KEY_USERNAME,
password: API_KEY_PASSWORD
},
data: {
"templateId": "wptemplate_ABc123XYZ",
"to": "jordan@usewaypoint.com",
"variables": {
"user": {
"displayName": "Jordan",
}
"product": {
"title": "Beechers Mac & Cheese",
"id": "02934203942"
}
}
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})