Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Hubot-compatible Tumblr API wrapper for Node.js
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.travis.yml
Makefile
Readme.md
package.json
tumblrbot.coffee

Readme.md

A Hubot-compatible Tumblr API wrapper for Node.js

Build Status

Tumblrbot is a simple API client for Tumblr.

It's useful in Hubot scripts. Here are a couple examples: pizza.coffee and gifsanity.coffee.

It's also perfectly usable in any other Node environment. I'd love to hear how you end up using it.

Install

npm install tumblrbot

Require

Use it in your Hubot script:

module.exports = (robot) ->
  tumblr = require('tumblrbot')(robot)

Or use it on its own:

tumblr = require('tumblrbot')

Use

# Get the latest 3 posts
tumblr.posts("funblog.tumblr.com").last 3, (data) ->
  console.log post.title for post in data.posts
```git@github.com:iangreenleaf/node-tumblrbot.git

The following options are available to help you filter by post type:
`posts`, `text`, `quote`, `link`, `answer`, `video`, `audio`, `photo`.

```coffeescript
# Get the most recent video post
tumblr.video("funblog.tumblr.com").last (data) ->
  console.log data.posts[0].title

# Or use the plural form (it's just an alias)
tumblr.videos("funblog.tumblr.com").last (data) ->
  console.log data.posts[0].title

# Or get it without the array
tumblr.video("funblog.tumblr.com").one (post) ->
  console.log post.title

You can pass any options specified in the Tumblr API:

tumblr.posts("funblog.tumblr.com").last 2, { tag: "potatoes" }, (data) ->
  console.log post.title for post in data.posts

Get a random photo post:

tumblr.photo("funblog.tumblr.com").random (post) ->
  console.log post.photos[0].original_size.url

Authentication

If process.env.HUBOT_TUMBLR_API_KEY is present, you're automatically authenticated. Sweet!

For many requests, it's enough for this to be the OAuth Consumer Key for your app - no need to go through the whole authorization process.

Helpful Hubot

Hubot will log errors if a request fails.

Something went wrong with that request. Please try again.