Tweet and Toot

Posted by @mattbirchler, Last update almost 6 years ago

This shares draft content to Twitter and Mastodon. Setup requires you to go to to set up an app in your Mastodon settings. Paste that key into the script and it should work very nicely.

This only works with right now, but clever users might be able to adjust this to work with the version of Mastodon they’d like.


  • script

    // Go to
    // to generate an app license for your account.
    // Currently only works with
    var credential = "123456789012345678901234567890123456789012345";
    // Setup API and content 
    var endpoint = "";
    var content = draft.content;
    var d = new Date();
    var rawTime = d.getFullYear();
    var date = d.getFullYear() + "-" + d.getMonth() + "-" + d.getDate();
    var id_key = "Drafts" + rawTime + "T" + date + "App";
    // create and post HTTP request
    var http = HTTP.create();
    var response = http.request({
      "url": endpoint,
      "method": "POST",
      "data": {
      		"status" : content
      "headers": {
        "Authorization" : "Bearer " + credential,
        "idempotency_key" : id_key
  • twitter



  • 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.