Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
post to tumblr every time a twitter user favorites a post
// -------------- SERVER.JS file ------------------
var Twit = require('twit'),
tumblr = require('tumblr.js');
var twitterAuth = new Twit({
consumer_key: 'your twitter key',
consumer_secret: 'your twitter secret',
access_token: 'your twitter token',
access_token_secret: 'your twitter token secret'
var tumblrClient = new tumblr.createClient ({
consumer_key: 'your tumblr key',
consumer_secret: 'your tumblr secret',
token: 'your tumblr token',
token_secret: 'your tumblr token secret'
// create a twitter stream for the user whos activity you want to track
var stream ='user', {track: 'twitter username to track'});
// when the twitter user favorites a post this is called
stream.on('favorite', function (event) {
// if the post contains an image, post it and other tweet info to tumblr
if ( != undefined) {"your tumblr blog url", {
caption: '<a href="' + event.target_object.user.screen_name
+ '">' + '@' + event.target_object.user.screen_name + '</a>: '
+ event.target_object.text,
function (response){
// ----------- PACKAGE.JSON file ------------------
"name": "twitterToTumblr",
"version": "1.0.0",
"description": "post twitter favs or retweets to tumblr blog",
"main": "server.js",
"scripts": {
"start": "node server.js",
"predeploy": "npm install",
"test": "echo \"Error: no test specified\" && exit 1"
"author": "travis irby",
"license": "MIT",
"dependencies": {
"tumblr.js": "0.0.4",
"twit": "^1.1.19",
"engines": {
"node": "0.10.x",
"npm": ">=1.3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.