Send Drafts Directly to Mem

skyturtle's photo
·Aug 23, 2021·

3 min read

👉🏾 "Send to Mem" Drafts Action

Drafts is an iOS app that allows you to easily capture text and send it to pretty much anywhere. I use it more as a launching point for text than a full-fledged notes app, though some people use it that way.

Mem is a recent entrant into the whole space of personal knowledge management, which seems to be exploding right now. The app is currently in an invite-only beta, but I received an invite a few days ago.

As a current Roam user, I was immediately blown away by its beautiful design. A few other things that jumped out at me early on:

  • all the app chrome fades away when you start typing so you can focus on your text
  • the sidebar for related mems is cleaner and easier to navigate than Roam's references sidebar
  • Mem Spotlight makes it easy to not only search but also use text from your mems in other apps

Anyway, that's not the focus of this article. If you'd like to see more of the app, the Getting Started with Mem video gives a nice overview.

Getting Your Mem Personal API Keys into Drafts

You will need to set up your Mem Personal API Keys:

  • Within Mem, select “Flows”
  • Select “Configure” under “API”
  • Click “Create New API Key”
  • Enter an API Key Label (I used “Drafts”)
  • Store the API key somewhere safe e.g. 1Password

The first time you run the action, Drafts will prompt you to enter the API key you just created and store it for later use. On subsequent runs, you will not have to enter your key.

Now you are all set up to start sending drafts directly to Mem 😎

Drafts Script and Mem API

The script is fairly straightforward and included below if you're wondering what's going on in the action.

I used the Shell example for creating a new mem and translated the curl request to use the Drafts HTTP Object.

Initially, I hardcoded the API keys into the script:

var key = "Your API key here"
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "ApiAccessToken " + key

This was not pleasant from a user experience and it could be a security issue if the user wanted to share the script with anyone. Thankfully, @sylumer let me know that Drafts has its own Credentials Object for exactly this use case. Here is the updated script:

// See online documentation for examples

var http = HTTP.create(); // create HTTP object
var url = ""
var content = draft.content
var credential = Credential.create("Mem API Key", "Personal API Key from Mem Flows")

credential.addPasswordField("apiKey", "Mem Personal API Key");


var response = http.request({
  "url": url,
  "method": "POST",
  "data": {
    "content": content
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "ApiAccessToken " + credential.getValue("apiKey")

if (response.success) {
  var text = response.responseText;
  var data = response.responseData;
else {
Share this