Action

Send to Mem

Posted by disinfeqt, Last update about 19 hours ago

Sends the draft to Mem 2.0

Steps

  • script

    var http = HTTP.create();
    var url = "https://api.mem.ai/v1/notes";
    var content = draft.content.trim();
    
    if (!content) {
      app.displayErrorMessage("Draft is empty. Please add some content.");
      throw "Empty content";
    }
    
    var credential = Credential.create("Mem API Key v1", "Personal API Key for Mem v1 API");
    credential.addPasswordField("apiKey", "Mem API Key");
    credential.authorize();
    var apiKey = credential.getValue("apiKey");
    
    var payload = {
      "content": content
    };
    
    var response = http.request({
      "url": url,
      "method": "POST",
      "data": payload,
      "headers": {
        "Content-Type": "application/json",
        "Authorization": "Bearer " + apiKey
      }
    });
    
    if (response.success) {
      app.displayInfoMessage("Mem note created successfully!");
    } else {
      app.displayErrorMessage("Failed to create Mem note: " + response.statusCode);
    }
    

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.