Action pastebin

Posted by maique, Last update over 1 year ago

This action creates a new paste on’s pastebin service,

First line will be “cleaned”, and used as paste title/filename, and the rest of the draft will be used as the paste.

The URL of the new paste will be on your clipboard when the action finishes.

You’ll need an account, and the API key for that account. You’ll be asked for both during first run.

Thanks to:




  • script

    // Storing the credentials in Draft's Credential instead of the action code directly
    // Thank you podiboq:
    var credential = Credential.create(" pastebin", "Store your API key username privately");
    credential.addTextField("omg_username", "Your username");
    credential.addPasswordField("omg_api_key", "API Key");
    // Get the values and store them: 
    let omg_api_key = credential.getValue("omg_api_key")
    let omg_username = credential.getValue("omg_username")
    let safeTitle = draft.processTemplate("[[safe_title]]");
    let hyphenTitle = safeTitle.replaceAll(" ", "-");
    draft.setTemplateTag("hyphen_title", hyphenTitle);
    var post_title = hyphenTitle.toLowerCase();
    var content = draft.processTemplate("[[trimmed_body]]");
      var http = HTTP.create();
      var response = http.request({
    	"url": "" + omg_username + "/pastebin",
    	"method": "POST",
    	"data": {
    	  "title": post_title,
    	  "content": content,
    	"headers": {
    	  "Authorization": "Bearer " + omg_api_key
    var final_url = "https://" + omg_username + "" + post_title


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