Slack API to query direct messages count between users - slack-api

I'm trying to see if they is a way to use the slack API to query how many messages two users are sending
From the API documents I think it should be using https://api.slack.com/types/im but I'm unsure how to query it
Any help will be good

The API looks like, it's not supposed to return absolute information like the count of the messages. But with the im.history you can get all messages and just count them. But for long chats this has a big overhead of getting all these messages. Also there's a limit to the count of messages you can query, so you might have to query all iteratively.

Related

Removing bot tweets when using Twitter API

Is there a way to remove bot tweets (or at least minimize it) when using Twitter API ?
Especially, I would like to know if it is possible to do that from the query.
But, I am open to any kind of solution.
My research :
I found that adding -is:nullcast -bio:bot -bio_name:bot -bio_location:bot -bio:TwitterBot -bio_name:TwitterBot -bio_location:TwitterBot at the end of a query minimize the amount of bot tweets received. But I still have a lot of bot tweets.

Bluemix - Use Insights for Twitter API to query if a topic is trendy

I'm implementing a sorting algorithm and I want to query the Insights for Twitter API in order to find if a topic is trendy in comparison to another topic.
As far as I've investigated, there is a Count API Operation which will return the number of Tweets based on a given query. Therefore I could query how many Tweets have the particular "keyword" in their body and then compare it to other different keywords to establish an order.
Is there is a more direct query to know if a keyword is trendy?
Your approach using the /api/v1/messages/count endpoint looks like the right one when working with the Insights for Twitter API.
I guess you could also use the posted query parameter to build trending charts over time for your different keywords.

Fetch all email from Gmail account

I can get the Information of user data and email address from google api with help from this link.
But my task is to get all user mails from a Gmail account, and display them in a table view.
I checked the Gmail API but can't get enough reference.
Is there any way to do it ?
You probably want to look into threads. While normally a programmer would probably think of background processes when talking about threads, Google refers to "groups" of messages as threads (how it groups an email and replies into a single message in the client). While the API Reference for threads has an example in Java, it shouldn't be too hard to translate it into Obj-C if you're already set up to make other calls to the Google API.
Specifically, look into the list method (linked above). Alternatively, you could use messages.list but they will be much less organized. Also know that I'm pretty sure you'll need to increase the maxResults as I believe the default max is 100.

I have IDs from many tweets; how can I fetch their full information with the Twitter API without exceeding the rate limit?

I have IDs from many tweets, and I'd like to fetch their full information from Twitter in order to do some data analysis. The obvious API method (https://dev.twitter.com/docs/api/1/get/statuses/show/:id) appears to take only one ID at a time. This is a problem because the number of tweets we need to analyze is well more than the API limit of 350 calls per hour.
Thus: is there some way to get full information for a set of tweet IDs, not just one, or alternately to submit many REST calls in the same HTTP request and have it count only once against the API limit?
There's unfortunately no bulk lookup offered for Tweets. You'll need to perform requests one at a time and scope your project to cope with the rate limitations. If you have friends who would like to help you, you could potentially ask them to authorize your application and leverage their permission to gain access to more requests.

How to get a list of all retweeters in Twitter?

I have seen numerous companies doing like Twitter lotteries where users got to retweet their tweet and then one of retweeters will get the prize or whatever.
I was wondering now how do they get the list of all retweeters or pick the winner?
I checked Twitter API and found only this thing: GET statuses/retweets/:id but it returns maximum of 100 retweeters. Is that the only way?
It looks likes there's a couple services out there doing almost exactly this. A quick google pulls up http://onekontest.com/ and there's a few other Twitter contest services, but they all seem to be different levels of broken since they haven't kept up with changes to the API.
As far as the Twitter API itself is concerned, if you were expecting more than 100 responses, I think using GET statuses/mentions makes the most sense. That API call returns any mentions of a user, and you can pass the flag include_rts to include any retweets of your tweets. Then, if you wanted to list RTs of a specific tweet, you could check the in_reply_to_status_id field in the returned data to see if it matches the original tweet ID. This API call only returns the last 800 status, 200 at a time, so if you expect a bunch of data, you would need to poll the API repeatedly over time to get all the tweets. I imagine services like favstar are doing exactly this, just on a larger scale.
If you're actually looking for code to do something like this, I wrote a sinatra app called twitter-rss-digest which handles querying Twitter over time to track different sorts of queries. It's pretty rough, and doesn't quite handle this specifically, but it might point you in the right direction if you want to code something.
The Twitter API has an endpoint that returns up to 100 retweeter IDs for a given tweet.
Note that for historical reasons, that endpoint only returns up to 100 results and the documentation about the cursor is useless. Twitter refused to fix the situation.
2013 note
That said, the first thread on the Developers site that surfaced in a quick google has #episod, a Twitter employee saying:
You can't likely get to all of them. The data is spread out. Your best bet is to use the REST API to determine many of the users who performed the retweet, but the data will still be constrained.
It's easiest to track retweets as they happen rather than try to find them from the past. Use the Streaming API for that.
I like muffinista's method, but I think if you want a 100% complete list of retweets, simply enable the retweet email notifications and write a script that polls the email box for those matching the subject "retweeted one of your Tweets!" and put the data into a table. Do this right from the start.
The site https://twren.ch/ enlists all the retweeters for a given tweet (note that it only enlists retweeters who are direct followers of the source tweeter.) Nevertheless its probably the only public source available.

Resources