Home

Awesome

tinderjs

Programmatic access to the Tinder API

Installation

$ npm install tinderjs

Introduction

tinderjs is a simple node.js wrapper around the Tinder API. Below is a simple example which gets a list of nearby profiles and prints them out:

var tinder = require('tinderjs');
var client = new tinder.TinderClient();

client.authorize(
  <fb user token>,
  <fb user id>,
  function() {
    client.getRecommendations(10, function(error, data){
      console.log(data.results);
    });
  });
});

Supported APIs

.authorize(fb token, fb id, callback)

Authorizes the TinderClient. You must call this before any other method.

.isAuthorized()

Returns bool if TinderClient is authorized or not.

.getAuthToken()

Returns xAuthToken from authenticated user. Will be good if you want to save/cache the info.

.getDefaults()

Returns information from tinder about your client, where you can find your user data and also globals (e.g: recs_size) that allows you to interact where api timeouts and limits.

.userId

Once authorized, this property will be set the current profile's tinder user id.

.sendMessage(user id, message, callback)

Sends a message to a user.

.like(user id, callback)

Likes a user (swipes right).

.pass(user id, callback)

Pass on a user (swipes left).

.getRecommendations(limit, callback)

Gets nearby users

.getUpdates(callback)

Checks for updates. The response will show you new messages, new matches, new blocks, etc.

.getHistory(callback)

Gets the complete history for the user (all matches, messages, blocks, etc.).

NOTE: Old messages seem to not be returned after a certain threshold. Not yet sure what exactly that timeout is. The official client seems to get this update once when the app is installed then cache the results and only rely on the incremental updates

.updatePosition(longitude, latitude, callback)

Updates your profile's geographic position

.getUser(user id, callback)

Get user information by id

Examples

The following example authorizes a client, gets some nearby profiles, likes all of them, and sends a message to any of the ones that match

var tinder = require('tinderjs');
var client = new tinder.TinderClient();
var _ = require('underscore')

client.authorize(
  <fb user token>,
  <fb user id>,
  function() {
    
    var defaults = client.getDefaults()
    var recs_size = defaults.globals.recs_size;
    
    client.getRecommendations(recs_size, function(error, data){
      _.chain(data.results)
        .pluck('_id')
        .each(function(id) {
          client.like(id, function(error, data) {
            if (data.matched) {
              client.sendMessage(id, "hey ;)");
            }
          });
        });
    });
  });
});

License

MIT