AngelList wrapper purely written in Node.js
Wrapper can be downloaded from npm:
npm install angel.co --save
Once installed, its easy to use it:
var angel = require('angel.co')('APP_ID', 'APP_SECRET');
Please follow the documentation from [https://angel.co/api/](AngelList documentation)
Module includes ability to let the user authenticate from AngelList. For now, its hard coded and asks for all ther permissions but you can change sa you like ;-)
Below example has been implemented with Express.js
you may modify it.
app.get('/auth/angel-list', function(req, res) {
res.redirect(angel.getAuthorizeUrl());
});
app.get('/auth/angel-list/callback', function(req, res) {
angel.auth.requestAccessToken(req.query.code, function(err, response) {
if ( err )
return console.error(err); //Something went wrong.
// I got the Token. Ain't you?
app.set('my_key_to_token', response.access_token); // Persist it anywhere.
res.redirect('/'); // Go back to the homepage.
});
});
You can store the access token returned from api and all your next request will use it.
angel.setAccessToken('your_access_token');
PS:
Your callback url must be similar to what you have configured while creating an app on AngelList.
You can serve this wrapper for following services:
- Users
- Startups
- Feeds
- Search
- Comments
- Follows
- Intros
- Messages
- Paths
- Press
- Reviews
- Startup Updates
- Startup Roles
- Tags
- Likes
- Jobs
Specification for the user is available at: https://angel.co/api/spec/users
It returns the data of logged in user.
angel.users.me('access_token_here', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.me().then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
To get the user, first argument must be the userId while another would be the set for query parameters.
angel.users.user('467664', {'include_details': 'investor'}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.user('467664').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns all the roles of user in organizations in which user is tagged in.
angel.users.roles('USER_ID', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.roles('USER_ID').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Helps to query multiple users at a time. First argument must be an array with the list of user ids.
angel.users.batch(['155', 671], function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.batch(['155', 671]).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Search the users by slug
and/or md5
of the user's email
angel.users.search({'slug': "hamza-waqas"}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.search({'slug': "hamza-waqas"}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns all the users related to the tag. Tag must be either LocationTag
or MarketTag
. First argument is the tagId, while another is the object
with k/v of query parameters.
angel.users.tags('1654', {
include_children: true,
investors: 'by_residence'
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.tags('1654', {
include_children: true,
investors: 'by_residence'
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the followers of the user.
angel.users.followers(671, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.followers('1654').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
OR
// Second argument as true will only return Ids of followers
angel.users.followers(671, true, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.followers('1654', true, {
include_children: true,
investors: 'by_residence'
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the entities that are followed by User.
angel.users.following(671, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.following('1654').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
OR
// Second argument as true will only return Ids of followers
angel.users.following(671, true, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.users.following('1654', true).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification of startup is available at https://angel.co/api/spec/startups
Returns the information of the given startup Id.
angel.startups.startup(6702, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.startups.startup('6702').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Retrieves all the comments of startup.
angel.startups.comments(6702, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.startups.comments('6702').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the company's startup roles. Direction must be either Incoming
or Outgoing
.
angel.startups.roles(6702, {direction: "outgoing"}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.startups.roles('6702', {direction: "outgoing"}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Filters the startups by criteria.
angel.startups.filter({filter: "raising"}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.startups.filter({filter: "raising"}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns companies that are tagged with the given tag or a child of the given tag. Results are paginated and ordered according to the order parameter.
angel.startups.tags(1654, {order: "asc"}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.startups.tags(1654, {order: "asc"}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the followers of the startup.
angel.startups.followers(6702, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Followers here.
})
//OR with promise
angel.startups.followers(6702).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
OR
// Second argument as true will only return Ids of followers.
angel.startups.followers(6702, true, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Followers here.
})
//OR with promise
angel.startups.followers(6702, true).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification for feeds entity is available at: https://angel.co/api/spec/activity_feeds
Returns site activity. If authenticated and the personalized parameter is passed in, only activity from the authenticated user's social graph is returned. No more than 25 items will be returned. Results are paginated and ordered by most recent story first, unless a since parameter is given.
angel.feeds.consume({
since: 'PRESAVED_UNIX_TIMESTAMP',
personalized: 1
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.feeds.consume({
since: 'PRESAVED_UNIX_TIMESTAMP',
personalized: 1
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification regardings calls and parameters for search is available at: https://angel.co/api/spec/search
Search by name for Startups, Users, MarketTags and LocationTags, optionally narrowing the results by type. Results are sorted by a mix of match and popularity.
angel.search.search({
query: "hamza-waqas",
type: "User"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.search.search({
query: "hamza-waqas",
type: "User"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Search for entity by slug directly.
angel.search.slugs({
query: "hamza-waqas"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.search.slugs({
query: "hamza-waqas"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification for the comments is available at: https://angel.co/api/spec/comments
Returns all the comments of entity.
angel.comments.comments({
commentable_type: "Startup",
commentable_id: 6702
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.comments.comments({
commentable_type: "Startup",
commentable_id: 6702
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Creates a new comment against commentable item.
angel.comments.create('I b reviewing it now!', {
commentable_type: "Startup",
commentable_id: 6702
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.comments.create('I b reviewing it now!', {
commentable_type: "Startup",
commentable_id: 6702
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Deletes a comment.
angel.comments.trash('comment_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.comments.trash('comment_id').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification of follows entity can be viewed at: tps://angel.co/api/spec/follows
Makes the authenticated user follow the specified item. Returns the new follow on success, or an error on failure.
angel.follows.follow({
type: "Startup",
id: "id_to_follow_here"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.follows.follow({
type: "Startup",
id: "id_to_follow_here"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Makes the authenticated user stop following the specified item. Returns the deleted follow on success, or an error on failure.
angel.follows.unfollow({
type: "Startup",
id: "id_to_follow_here"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.follows.unfollow({
type: "Startup",
id: "id_to_follow_here"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the relationship between source and target.
angel.follows.relationship({
source_id: "source_id_here",
target_type: "User_or_Startup",
target_id: "relational_id"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.follows.relationship({
source_id: "source_id_here",
target_type: "User_or_Startup",
target_id: "relational_id"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the follower and followed information based on comma-separated follow ids, such as those from the activity feed.
angel.follows.batch([1,2,3,4,5], function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
//OR with promise
angel.follows.batch([1,2,3,4,5]).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
API doc is available at: https://angel.co/api/spec/intros
Creates an introduction between User & Startup.
angel.intros.create({
access_token: "of_authenticated_user",
startup_id: 6702,
note: "Lets make some chit chat sometime and Zuck's place?"
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Got it here!
});
//OR with promise
angel.intros.create({
startup_id: 6702,
note: "Lets make some chit chat sometime and Zuck's place?"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
The specification for the API is available at: https://angel.co/api/spec/messages
PS:
You require the message
permissions applied within the authentication scope first.
Returns all the messages of the given thread id.
angel.messages.list({
view: "inbox",
access_token: "access_token_here"
},function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.messages.list({
view: "inbox"
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns all the messages of the given thread id.
angel.messages.message(
'thread_id',
{access_token: "access_token_here"},
function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
}
);
//OR with promise
angel.messages.message('thread_id').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Creates a new message within thread.
angel.messages.create({
thread_id: '',
recipient_id: '',
body: 'So, did you got my message? Errh!'
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.messages.create({
thread_id: '',
recipient_id: '',
body: 'So, did you got my message? Errh!'
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Marks the messages as viewed by the user.
angel.messages.mark([1,2,3,4], {
access_token: ""
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.messages.mark([1,2,3,4]).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Grab the verbose and documentation for paths from: https://angel.co/api/spec/paths
Returns the path between You and the provided User / Starup Ids.
angel.paths.path({
access_token: "",
user_ids: [],
startup_ids: [],
direction: 'following/followed'
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.paths.path({
access_token: "",
user_ids: [],
startup_ids: [],
direction: 'following/followed'
}).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Please find the specification at: https://angel.co/api/spec/press
Returns all the presses related to the startup id.
angel.press.startup(6702, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.press.startup(6702).then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the press of the given press id.
angel.press.press('press_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
//OR with promise
angel.press.press('press_id').then(function(body){
console.log(body);
}).catch(function(error){
console.log(error);
});
API specification is available at: https://angel.co/api/spec/reviews
Returns all the reviews of the user.
angel.reviews.get('user_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.reviews.get('review_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns a single review by id.
angel.reviews.review('review_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.reviews.review('review_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification can be found at: https://angel.co/api/spec/startup_roles
Given a user_id, returns the companies that User is tagged in. Given a startup_id, returns either the users and companies tagged in the given Startup (if direction is incoming) or the companies which the given Startup is tagged in (if direction is outgoing). If neither parameter is given, the authenticated user is used. Possible roles include founder, employee, past_investor, current_investor, advisor, incubator and referrer. Roles are paginated and ordered by most recently declared first.
angel.startup_roles.get({
user_id: '',
startup_id: '',
role: '',
direction: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.startup_roles.get({
user_id: '',
startup_id: '',
role: '',
direction: ''
}).then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Please find the specification of the api at: https://angel.co/api/spec/status_updates
Return status updates from the given user or startup. If neither is specified, the authenticated user is used. Status updates are paginated and ordered by most recent first.
angel.startup_updates.get({
user_id: '',
startup_id: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.startup_updates.get({
user_id: '',
startup_id: ''
}).then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Creates a new startup update.
angel.startup_updates.create({
startup_id: '',
message: '',
access_token: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.startup_updates.create({
startup_id: '',
message: ''
}).then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Trashes the startup update.
angel.startup_updates.trash(':id', {
access_token: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.startup_updates.trash(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Please find the specification of the api at: https://angel.co/api/spec/tags
Returns tag with related information by Id.
angel.tags.tag(':id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.tags.tag(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the children of the given tag.
angel.tags.children(':id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.tags.children(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Returns the parents of the given tag id.
angel.tags.parents(':id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.tags.parents(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Retrieves the startups related to the tag.
angel.tags.startups(':id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.tags.startups(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Retrieves the users related to the tag.
angel.tags.users(':id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.tags.users(':id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Please find the specification of the api at: https://angel.co/api/spec/likes
Returns the likes over the likable entity.
angel.likes.likes({
likable_type: '',
likable_id: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.likes.likes({
likable_type: '',
likable_id: ''
}).then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Creates a new Like action over Likable story.
angel.likes.like({
likable_type: '',
likable_id: ''
}, function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.likes.like({
likable_type: '',
likable_id: ''
}).then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Creates a new delete / unlike action over Likable story.
angel.likes.unlike('like_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body); // Something with messages here.
});
// OR with promise
angel.likes.unlike('like_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Specification for the jobs is available at: https://angel.co/api/spec/jobs
To list the jobs.
angel.jobs.list(function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
// OR with promise
angel.jobs.list().then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
To get a job, first argument must be the id of that job.
angel.jobs.job('job_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
// OR with promise
angel.jobs.job('job_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
To get the list of jobs from a startup, first argument must be the startup id.
angel.jobs.startup('startup_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
// OR with promise
angel.jobs.startup('startup_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
To get the list of jobs from a tag, first argument must be the tag id.
angel.jobs.tag('tag_id', function(err, body) {
if ( err )
return console.log(err);
console.log(body);
});
// OR with promise
angel.jobs.tag('tag_id').then(function(body) {
console.log(body);
}).catch(function(error){
console.log(error);
});
Please feel free to open a new issue ticket if any occures. I love pull requests so they are also welcome. Before making it out the issue, please verify the required arguments / parameters from AngelList
api source.
These are the most important TODOs that are supposed to be done. If you can make pull request, I'd love to accept it (if it really has to).
- Create Jasmine / Mocha test cases to validate each of the service.
- Few workable examples might be there to even make it more verbose.
- Code Cleanup. I hate dirt but sometimes has to do!
- You call it!
This wrapper is solely written at Kuew Inc
by Hamza Waqas