Install and use TwitteR to DM when task is done

Thursday, March 22nd, 2018
Commands, R, Software, Ubuntu
,
None

After trying several annoying “recipes” I landed on this approach on Ubuntu (Linux). Will try Windows later on to see if it differs. I use R-studio.

Update: Worked fine on Windows (just skip the first section)

 

Installing on Ubuntu

Got a bunch of errors trying to install “devtools” in R. First install packages (terminal): sudo apt-get install libssl-dev

still got errors and went on to install this: sudo apt-get install libssl-dev

TwitteR install on Ubuntu and Windows

Went on to install the following R-packages:

install.packages(c("devtools", "rjson", "bit64", "httr"))

Loading library and installing twitteR via GitHub:

require(devtools)
install_github("geoffjentry/twitteR")

Creating twitter app

Create a Twitter application at http://dev.twitter.com. Make sure to give the app read, write and direct message authority. You can change this under the Permissions tab. The information about API stuff is found under Keys and Access Tokens

Go nuts with twitteR

require(twitteR)

# copy paste from web
APIkey           = "insert_here"
APIsecret        = "insert_here"

# set up and follow the steps
setup_twitter_oauth(APIkey, APIsecret)

Once completed you’re ready to go!

The function taskStatus sends a Twitter DM after completion of a task to twitter_user:

taskStatus(print("Watch your fucking phone!"), "twitter_user", msg = " It's fucking working!")


Back

Post Archive

by Date: