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 authHeader =
'Basic ' + Buffer.from(`${API_KEY_USERNAME}:${API_KEY_PASSWORD}`).toString('base64');
fetch('https://live.waypointapi.com/v1/email_messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: authHeader,
},
body: JSON.stringify({
templateId: 'wptemplate_ABc123XYZ',
to: 'jordan@usewaypoint.com',
variables: {
user: {
displayName: 'Jordan',
},
product: {
title: 'Beechers Mac & Cheese',
id: '02934203942',
},
},
}),
});