Action

sendtoMemos

Posted by lizhimao, Last update about 1 year ago - Unlisted

action to send draft to memos, a selfhost memo application, for more information,checkout https://usememos.com/

Steps

  • script

    /*
      post to Memos
      using Memos API
    */
    
    // First run, you will be prompted for
    // Account page
    var credential = Credential.create("Memos API", "get open API config from your memos instance account page.");
    
    credential.addTextField("memosapi", "Memos API");
    credential.authorize();
    
    var memosapi = credential.getValue("memosapi");
    
    // Setup micro.blog API and content 
    var endpoint = memosapi
    var content = draft.content
    if (content.length > 0) {
      // create and post HTTP request
      var http = HTTP.create();
    
      var response = http.request({
        "url": endpoint,
        "method": "POST",
        "data": {
        		"content": content
        },
        "headers": {
          "Content-type": "application/json"
        }
      });
    }
    
    console.log("Response: " + response.statusCode);
    
    if (response.statusCode != 200 && response.statusCode != 202) {
      context.fail();
    }

Options

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