Google Apps Script で Twitter に投稿する

function post(text) {
 var config = UrlFetchApp.addOAuthService("twitter");
 config.setAccessTokenUrl("https://api.twitter.com/oauth/access_token");
 config.setRequestTokenUrl("https://api.twitter.com/oauth/request_token");
 config.setAuthorizationUrl("https://api.twitter.com/oauth/authorize");
 config.setConsumerKey(ScriptProperties.getProperty("consumerKey"));
 config.setConsumerSecret(ScriptProperties.getProperty("consumerSecret"));

  var options =
  {
    "oAuthServiceName" : "twitter",
    "oAuthUseToken" : "always",
    "method" : "POST"
  };
  var tweet = encodeURIComponent(text);
  var result = UrlFetchApp.fetch("https://api.twitter.com/1.1/statuses/update.json?status=" + tweet, options);
  Utilities.jsonParse(result.getContentText());
}