Skip to content

Instantly share code, notes, and snippets.

@jordanisip
Last active June 14, 2023 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordanisip/5b3a93dde18c7e66d3b02ed4cb9ff77b to your computer and use it in GitHub Desktop.
Save jordanisip/5b3a93dde18c7e66d3b02ed4cb9ff77b to your computer and use it in GitHub Desktop.
Waypoint Axios example
const axios = require('axios');
axios({
method: 'post',
url: 'https://live.waypointapi.com/v1/email_messages',
headers: {
'Content-Type': 'application/json'
},
auth: {
username: 'YOUR_API_KEY_USERNAME',
password: 'YOUR_API_KEY_PASSWORD'
},
data: {
templateId: 'YOUR_TEMPLATE_ID',
to: 'YOUR_TEST_EMAIL_ADDRESS',
variables: {
reservationRequest: {
id: '2334234',
displayName: 'Jordan',
startDate: 'Aug 1',
endDate: 'Aug 29',
message: 'Any chance you have time to watch my dog, Odin, again?',
}
}
}
})
.then(function (response) {
// handle success
console.log(`https://dashboard.usewaypoint.com/o/YOUR_PLATFORM_ID/events/${response.data.data.id}`);
})
.catch(function (error) {
// handle error
console.log(error);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment