Reputation: 15370
I am using the Twitter web-intents / javascript API, and I'm a bit surprised. What I'd like to do is listen for an event after a tweet occurs. Following their example:
twttr.events.bind('tweet', function(event) {
// Do something there
});
However, what I'd like to do is store the tweet id, or some other relevant information. If I take a look at the event
object, there doesn't appear to be any relevant information in the data
attribute.
Is it possible to obtain the tweet ID (or any other details about the tweet) by listening to a tweet event?
Upvotes: 11
Views: 1554
Reputation: 1517
As Xeno as cited, you're not able to get such information from the Browser JS Widget from Twitter. The Event Bindings are only intended to the following purpose:
By adding listeners to the actions users perform in Web Intents, you can trigger functionality in your app, or send (anonymous) data about those events to your web analytics system (like Google Analytics, Omniture, or your own analytics engine.)
So basically, you're able to do something within your app after the user has tweeted something.
At this JSBin (http://jsbin.com/nalexuwuhi/1/) I've just created a basic test, where you're able to see the whole event object. The "tweet_id" value is only intended to "say" twitter to which tweet you're responding, e.g. the parent tweet and not what the tweet_id of the create tweet is. I think for such purpose you have to use the twitter api and therefore some server-side coding.
Upvotes: 0
Reputation: 3905
If you want the tweet id you can use twitter's streaming API where they provide almost all the details with regards to a tweet.
But this has a catch as you will need to know the hashtag or at-least a part of the content of the tweet.
Upvotes: 0
Reputation: 1503
Web Intent events exist as a mechanism to trigger functionality in your page, not a data API.
The tweet event gets fired to indicate that a Tweet has happened, but we don't provide identifying information through the event payload: Intents function on your site without a user authorizing you access to their account, and providing a Tweet ID for an anonymous user's action would implicitly provide you with their identity.
Upvotes: 4