In early August of 2022, I launched Takeout. Originally it was supposed to be a side project that allows my other applications to quickly send emails, but it grew into more of an actual project 😆.
While I think Takeout's documentation for Takeout.js is wonderful, I'm sure some prefer a blog post to get started with a new platform.
Getting started
Go to takeout.bysourfruit.com, click "Get started" and follow the steps to create a free account. Takeout will prompt you to login with GitHub, and after successfully signing up you'll be redirected to the dashboard. From here, you can configure Takeout to track email opens, set up a custom email, and more.
At the moment, we only want one thing from the dashboard, and that's your token. Hop on over to the Credentials tab and copy your token. You'll need it later.
Installation
You can install Takeout.js using either NPM
$ npm install takeout.js
or Yarn
$ yarn add takeout.js
Configuration
You'll have to import Takeout, like so:
const TakeoutClient = require('takeout.js')
const client = new TakeoutClient()
And now, you get to use your token!
client.login('your token here')
This should be your (e.g) index.js
:
const TakeoutClient = require('takeout.js')
const client = new TakeoutClient()
client.login('your token here')
Creating an email template
To actually send an email, Takeout needs to know a few things, mainly:
- Who's the email coming from?
- Where's the email going?
- What's the email's subject?
- What's the email's content?
While content (text or HTML) isn't required, it's encouraged to send it in an email 😉
Here's an example template:
const emailTemplate = {
to: 'test@example.com',
from: 'Takeout.js',
subject: 'I just sent an email using Takeout!',
html: "<b>My first email!</b>",
}
This'll send "My first email!" in bold. This email is also eligible to be tracked!
Here's another email template:
const emailTemplate = {
to: 'test@example.com',
from: 'Takeout.js',
subject: 'I just sent an email using Takeout!',
text: 'My first email!',
}
This'll send "My first email!" with zero styling- just plain text. This email isn't eligible to be tracked.
Sending the email
Now we're actually going to send the email we just defined.
client.send(emailTemplate)
Make sure to, of course, change whatever you'd like. If you want to actually see the email you send, consider changing the 'to' parameter.
That's it!
There's more options and features, but this covers the basics and is a great starting point to begin sending thousands of emails with Takeout!
You can read more here
Top comments (0)