Skip to content

Instantly share code, notes, and snippets.

View PeterBerthelsen's full-sized avatar

Peter Berthelsen PeterBerthelsen

  • Minneapolis
View GitHub Profile
@PeterBerthelsen
PeterBerthelsen / OrthoBot2
Created January 21, 2019 14:58
OrthoBot Reply Processing
//////////////////////////Reply/Thread////////////////////////////////////////////////////////
if (IdInResponseTo == 0 || IdInResponseTo == null) { //If no reply is provided...
console.log("No reply ID provided."); //log no reply
} else { //If Reply (or thread) is set up...
var ReplyId = IdInResponseTo; //variable for replies, passed to .sendTweet
console.log("In response to: " + ReplyId) //log response to
params.in_reply_to_status_id = ReplyId; //send with reply
params.auto_populate_reply_metadata = true; //auto-mentions previous user (for thread)
}
@PeterBerthelsen
PeterBerthelsen / OrthoBot1
Created January 20, 2019 16:43
OrthoBot Authorization
function sendTweet(TweetText, IdInResponseTo, ImageAttachURL){
//////////////////////////Set Variables///////////////////////////////////////////////////////
var ss = SpreadsheetApp.getActiveSpreadsheet(); //spreadsheet
var logsheet = ss.getSheetByName("TweetLog");
var lastRow = Math.max(logsheet.getLastRow(),1) + 1;
var twitterKeys= { //Twitter Authentication Tokens to pass through props
TWITTER_CONSUMER_KEY: "[YOUR KEY HERE]",
TWITTER_CONSUMER_SECRET: "[YOUR SECRET HERE]",
TWITTER_ACCESS_TOKEN: "[YOUR TOKEN HERE]",
TWITTER_ACCESS_SECRET: "[YOUR SECRET HERE]"