Anywhere get mentions


#1

Hello guys :slight_smile:

Well, I’ve been making a sort of minimalist client for twitter only using anywhere but I’m unable to get the user mentions… after reading a bit the anywhere code, I found that doing this:

if (T.isConnected()) {
    console.debug(T.currentUser.mentions());
}

Throws an object with a bunch of functions, which I don’t know how to use. Tracking the network I found the script made a successful request to https://api.twitter.com/1/statuses/mentions.json with my current access token in a get variable, and that the request answered with my last mentions in a json format. So they should be stored somewhere! How can I get them?

Many thanks for such a great API.


#2

Not sure if you found out how to do this, but here it is anyway:

T.currentUser.mentions().first(20).each(function(status) {
console.debug(status.text);
});

will display the text of each mention. You can get all the other bits of data by pulling them out of the status variable… status.user.screenName (who it’s from) etc


#3

Wow! thank you! I went to the server instead but this is wonderful! I’ll use it very soon :slight_smile: thank you a lot.

Another thing, is there a well explained resource for this details? I think it drastically increase Anywhere’s potential.


#4

You’re welcome.
There doesn’t appear to be any proper documentation for @anywhere, not sure why this is, Twitter don’t seem to want to encourage developers to use it. They have their main page explaining the tweetbox etc, but none of these other functions. I’ve worked them out by searching on google and various blog posts for specific commands. Also, once you know the above example, you can work out how to do other things by reading the standard REST API docs… or I guess, just ask on this forum.

Scott


#5

I tried this and cant get data to display. Here is what I have:

I’m trying to get a list of my 5 latest mentions…Any help would be awesome! Thanks!


#6

well thank you


#7

my local computer still seems to be aware about the twitter account after Twitter Signout.
I integrated Twitter into one of the websites that I am creating. However, when I signout of twitter from my webpage that includes the code for @Anywhere, my local computer still seems to be aware about the twitter account. In other words, if I sign in to twitter again using the “Connect to Twitter” button, a small popup screen comes up asking me if I want to connect with my existing twitter account. I want the person to Sign out completely, and any attempts to Connect to Twitter again using my webpage should force the user to enter Twitter LoginID and password again. I pasted some of my JavaScript code below. May I please know how I can make the Twitter signout code within my webpage to force the user signout “completely” ?
<
scripttype=”text/javascript”>twttr.anywhere.config({ callbackURL: “www.perlswebapplication.com/perlsTwitterTweetBoxPage.aspx”});//This function Updates HTML elements functionupdate(T){if
document.getElementById(
document.getElementById((T.isConnected()) {‘user’).innerHTML = ‘Logged in as : ‘+ T.currentUser.data(‘screen_name’);’logout’).innerHTML = ‘Sign out of Twitter‘; //Add tweet box T(
height: 100,
width: 400,
defaultContent: “#tbox”).tweetBox({“”});
}
}
twttr.anywhere(
update(T);function(T) {//connect button T(
authComplete: ‘#login’).connectButton({ function(loggedInUser) { // triggered when auth completed successfully update(T);
location.reload(); //reload the page },
signOut: function() { // triggered when user logs out document.getElementById(
document.getElementById(
document.getElementById(
location.reload(); ‘logout’).innerHTML = ”;’tbox’).innerHTML = ”;’user’).innerHTML = ”;// reload the page}
});
});


#8

#9

#10