Action
Post to Micro.blog
Post to a Micro.blog hosted account. First time running this action, you will need to provide an app token generated from your profile at Micro.blog
Steps
-
script
/* post to Micro.blog hosted account using Micropub API */ // First run, you will be prompted for // App Token. Generate tokens on the Micro.blog // Account page var credential = Credential.create("Micro.blog", "Insert Micro.blog app token generated on Micro.blog account page."); credential.addTextField("apptoken", "App Token"); credential.authorize(); var appToken = credential.getValue("apptoken"); // Setup micro.blog API and content var endpoint = "https://micro.blog/micropub" var content = draft.content // create and post HTTP request var http = HTTP.create(); var response = http.request({ "url": endpoint, "method": "POST", "encoding": "form", "data": { "h": "entry", "content": content }, "headers": { "Authorization": "Bearer " + appToken } }); console.log("Response: " + response.statusCode); if (response.statusCode != 200 && response.statusCode != 202) { context.fail(); }
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.