Action
Pastebin Public
Send note to Pastebin as a public note. No author (“guest”) or privacy.
It asks before running to be sure you don’t accidentally expose your secrets.
Steps
-
script
var credential = Credential.create("PastebinPublic", "Insert Pastebin developer API key."); credential.addTextField("devtoken", "Dev Token"); credential.authorize(); var pbToken = credential.getValue("devtoken"); var endpoint = "https://pastebin.com/api/api_post.php"; var content = draft.content; // create and post HTTP request var http = HTTP.create(); var response = http.request({ "url": endpoint, "method": "POST", "encoding": "form", "data": { "api_dev_key": pbToken, "api_option": "paste", "api_paste_name": draft.title, "api_paste_code": content } }); console.log("Response: " + response.statusCode); if (response.statusCode != 200 && response.statusCode != 202) { context.fail(); } else { var pasteURL = response.responseText; app.setClipboard(pasteURL); console.log("New paste: " + pasteURL); var ts = new Date(); draft.content += "\r\n\r\nPublic pastebin link: " + pasteURL + " created " + ts.toLocaleString(); // ts.toISOString(); draft.addTag("pastebin"); draft.update(); }
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.