@usewaypoint/client
v0.0.9
Published
node.js client for the [Waypoint api](https://www.usewaypoint.com).
Downloads
1,844
Readme
@usewaypoint/client
Waypoint is a platform for product teams to send, manage, and automate dynamic transactional emails – with little to no code.
This is the Node.js library to access the Waypoint API.
Sending your first email
1. Install npm package
npm install @usewaypoint/client --save
2. Import and initialize a client
import { createClient } from '@usewaypoint/client'
const client = createClient('USERNAME', 'PASSWORD');
3.1 Send a templated email message
// You can also use `client.sandboxEmailMessages.createdTemplated()`
await client.emailMessages.createTemplated({
templateId: // template id example: 'wptemplate_xxxxxxxxxxxxxxxx',
to: // email address of recipient,
variables: // variables expected by the template,
});
3.2 Send a raw HTML email message
// You can also use `client.sandboxEmailMessages.createRaw()`
await client.emailMessages.createRaw({
to: // email address of recipient,
bodyHtml: '<h1>Hello world</h1>',
});
Development and releasing
Build a release version
npm run build
npm publish