Skip to content

Instantly share code, notes, and snippets.

@EverettBerry
Created July 31, 2022 00:44
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 EverettBerry/21337159862b8f97a112946e8c6f8a37 to your computer and use it in GitHub Desktop.
Save EverettBerry/21337159862b8f97a112946e8c6f8a37 to your computer and use it in GitHub Desktop.
const { TrackClient, RegionUS, SendEmailRequest, APIClient } = require('customerio-node')
const customerioSiteId = process.env.CUSTOMER_IO_SITE_ID
const customerioApiKey = process.env.CUSTOMER_IO_API_KEY
const api = new APIClient(process.env.CUSTOMER_IO_APP_KEY, { region: RegionUS })
const customerio = new TrackClient(customerioSiteId, customerioApiKey, {
region: RegionUS
})
const createMail = (mailObj) => {
return new SendEmailRequest(mailObj)
}
const sendMail = async (request) => {
const response = await api.sendEmail(request)
return response
}
const sendMailFromObject = async (mailObj) => {
const response = await api.sendEmail(createMail(mailObj))
return response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment