Skip to content

Event-based, object-oriented Instagram API for NodeJS. This is *not* a wrapper. Rather, it is a minimal-setup, trigger-based NodeJS object, that handles push notifications from the Instagram API. How does it do this? Middleware. This package is so sick, and removes the stress from asynchronously programming via cURL. Duh.

License

Notifications You must be signed in to change notification settings

internet-research-labs/instagram-realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

instagram-realtime

Event-based, object-oriented Instagram API wrapper for NodeJS

That is, program instagram-related things, using an event-driven framework. Note that this adds middleware, which handles the Instagram API's subscription verification.

Minimal Example

var app     = require('express')();
var colors  = require('colors');
var server  = require('http').createServer(app).listen(process.env.PORT || 5000);

var InstagramStream = require('instagram-realtime');
var secrets = require('./secrets.json');

var stream = InstagramStream(
  server,
  {
    client_id     : secrets.client_id,
    client_secret : secrets.client_secret,
    url           : secrets.url,
    callback_path : 'callback'
  }
);

stream.on('unsubscribe', function (req, resp) {
  console.log('unsubscribe'.green);
  stream.subscribe({ tag : 'yolo' });
});

stream.on('new', function (req, body) {
  console.log(body);
});

app.get('/', function (req, resp) {
  resp.set('Content-Type', 'text/plain; charset=utf-8');
  resp.end('🍕🏊');
});

stream.unsubscribe('all');

Methods

Brief description of functions

subscribe

Subscribe to a hashtag:

stream.subscribe({ tag : 'yolo' });

Subscribe to a geographic location:

stream.subscribe({ lat:35.657872, lng:139.70232', radius:1000 });

Subscribe to a location by ID:

stream.subscribe({ location : 2345 });

Subscribe to all users registered with the app:

stream.subscribe({ user : true });

unsubscribe

Unsubscribe from a stream:

stream.unsubscribe();

on

Register a trigger for unsubscription:

stream.on('unsubscribe', function (response, body) {
}
stream.on('unsubscribe/error', function (error, response, body) {
}

Register a trigger for subscription:

stream.on('subscribe', function (response, body) {
}
stream.on('subscribe/error', function (error, response, body) {
}

Register a trigger for new media:

stream.on('new', function (response, body) {
}
stream.on('new/error', function (error, response, body) {
}

TODO

  1. Adjust function callbacks
  2. Update docs

License

MIT

Author

Matt Razorblade Hammerstadt @mattvvhat

About

Event-based, object-oriented Instagram API for NodeJS. This is *not* a wrapper. Rather, it is a minimal-setup, trigger-based NodeJS object, that handles push notifications from the Instagram API. How does it do this? Middleware. This package is so sick, and removes the stress from asynchronously programming via cURL. Duh.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •