/twitter-mentions

get latest mentions for target username

Primary LanguageJavaScript

twitter-mentions

NPM version Build Status Coveralls Status Dependency Status

get latest mentions for target username

Install

npm install --save twitter-mentions

Usage

import twitterMentions from 'twitter-mentions';
import tokens from 'twitter-tokens';

twitterMentions(tokens, '424119506508980224').then(mentions => {
  console.log(mentions); // [{…}, {…}, …]
});

API

getMentions(tokens, sinceId)

Return a promise that resolves to mentions.

As far as statuses/mentions_timeline endpoint requires authentication with user context only, it means there is no way to specify which mentions you want to get, once you get tokens after some user authentication, you will be able to get mentions only for this user.

tokens

Required
Type: Object

Valid Twitter developer credentials (tokens) in the form of a set of consumer and access tokens/keys. You can use twitter-tokens, to simplify getting tokens.

sinceId

Required
Type: String

id_str of tweet since which you want to get latest mentions. Result array will not contain this tweet. If you want it to contain that tweet use bignum-dec: getMentions(tokens, bignumDec(tweet.id_str));. See tests for details.

Return results with an ID greater than (that is, more recent than) the specified ID. There are limits to the number of Tweets which can be accessed through the API. If the limit of Tweets has occured since the since_id, the since_id will be forced to the oldest ID available.
Twitter API statuses/mentions_timeline

Related

License

MIT © Vladimir Starkov