blog

Scheduling emails through the API

You can now use the Buttondown API to schedule future newsletters!

Scheduling emails through the API
Note
CloseThis blog post is from 2019. Contents (and screenshots) may be a bit of out date, but we've kept it up out of posterity.

Scheduled emails has always been an important part of Buttondown’s platform. I use it every time I send out a newsletter update, whether it’s a new feature or a weekly update.

And — without beating around the bush too much — you can now schedule emails through the API! With a simple API request, you can now schedule an email to get sent out next Tuesday!

Or with just a handful lines of, say, Python code:

import os
import requests
API_KEY = os.environ["BUTTONDOWN_API_KEY"]
API_URL = "https://api.buttondown.com"
ENDPOINT = "/v1/scheduled-emails"
data = {
"subject": "Check out this email from the API",
"body": "Hopefully the content is dope!",
"publish_date": "2020-05-08T12:00:00"
}
requests.post(f"{API_URL}{ENDPOINT}", data ,headers={
"Authorization": f"Token {API_KEY}"
})

And of course, this works out of the box with any other way you might want to use Buttondown’s API — like, say, Siri Shortcuts or Zapier. Because APIs are neat.

(If you’re not familiar with Buttondown’s API, check out our schema and head over to your Settings page to grab your API key!)

Published on

May 23, 2019

Filed under

Written by

Justin Duke

Justin Duke is a software engineer, lover of words, and the creator of Buttondown.

No credit card required. Only pay for what you use. Cancel anytime.