Twitter API: how to know what application was used to follow - twitter

In the email notification we can see something like
<username> followed you using <appname>.
It is great. But is there any possible way to know the application name using API?

I took a look through the REST API, and I could not find anything that would support this. My guess is that this is a twitter.com feature that is available in the API (yet).
The most logical places I looked were statuses/followers and friendships/show. In both cases there was nothing definitive. Checking the follower emails for my account, I found multiple followers that used applications (like PeopleBrowr and SocialOomph) to follow the account. In most cases, the source on their latest status object matched the application name used to follow me, but that was definitely not a sure thing.
So, to answer your question directly, no I don't think it can be done through the API (not unless there's an undocumented method out there that does this.)
I can, however, think of a way to get that info. One approach would be to set up the email account receiving the follow notifications to forward a copy to a mailbox that is checked by an automated process. When emails show up, parse them to find the app name used to follow you.
I used the following regular expression (in C#) to find the application's name and URI in the email's body:
Match m = Regex.Match(input, #"followed you using\s*<a[^""]+""(?<appUri>[^""]+)""[^>]+>(?<appName>\w*)</a>");
I used m.Groups["appName"].Value to pull out the application name, and m.Groups["appUri"].Value to pull out the URI from the match.
In order to tie the app info to a user, I had to also find the screen name with:
Match m = Regex.Match(user, #"\(#<a[^>]+>(?<screenName>\w*)</a>\) is now following");
I used m.Groups["screenName"].Value to extract the value from the match.

Related

Use mention in dialog Slack

I have developed a slack bot which purpose is to give details about the company's projects.
I tried to use slack dialog to ask for different information such as the name, a description and the people involved in the project.
To do the last part (people involved), I wanted to use mention (#), so that the person who adds the project doesn't have to know the exact name / email of each participants. I'm pretty sure it's not possible but before trying another solution, I wanted to ask since I didn't find anything on internet.
Can we or can we not use mentions in slack dialog ? And if we can, how ?
No, the Slack Dialog currently does not have support for multiple mentions. The text elements will has support for url, email, number and telephone number. But not for mentions.
However, mentions work nicely with slash commands. You can add a list of users after your slash command with a mention and their will be automatically detected and matched to list of Slack user.
So maybe its possible for you to start with a slash command including mentions and use the Dialog to request additional information.

Asana: convert user #-tag to API object

I'm parsing the description of tasks for user links (#-tags) that we use to identify different roles on an item. I noticed something weird about the IDs though.
In the notes of a task returned from the API the #-tags are converted to links in the form https://app.asana.com/0/<int_id>/<int_id> which, when visited in the browser, show the user's tasks but when I use that ID to query the API as in https://app.asana.com/api/1.0/users/<int_id> I get a 403 with this response: {"errors":[{"message":"user: Not the correct type"}]} - further investigation showed that the IDs used in the #-tags are different from those used in the API for the same user, even though they both lead to the same page.
My question is are these IDs meant to be opaque or is there a way to convert them to the correct corresponding API IDs (short of browser scraping)?
Unfortunately, it's not possible at this time. In comments and notes (basically, anywhere in Asana that Rich Text is possible), we represent users as the URI to their "My Tasks" page, which is different from their User ID (as you noticed).
We are exploring ways to close this gap, but don't have anything to share at this time. I know that's not super helpful, but I hope it at least helps to have a definitive answer :-(

Google+ Authorship: #REL, GET Parameters and Redirects

I recently decided to start to take advantage of rich snippets to improve my personal website's content for the search engines and, IMHO most importantly, the site readers – hi, Mam! ;-). One of these are Google Authorship. Personally, I think the idea behind Google Authorship is a sound one: it helps to brings a sense of identity, personality and – arguably, most importantly – credibility to what is still largely an anonymous web.
Normally, I would link my article to Google Authorship using the following line of HTML:
<A REL="author" HREF="https://plus.google.com/112431363835029530079?rel=author">Jordan Clark</A>
However, in the instance of a website that publishes articles that are written by multiple authors, manually entering each another’s Google+ UID string starts to become a tiresome process.
Is is valid to do the following:
(a) Link to the author like so, using the script "author.php" (or other type of server-side script).
<A REL="author" HREF="/author.php?by=Alice&rel=author/[UID]?rel=author">Alice</A>
(b) The file "author.php" scripts simply do a quick check for Alice's (or whoever) User ID string provided by Google, and then uses a simple HTTP redirect header to pass this data to Google.
What I would like to know is:
Is it okay to use a local script to redirect to your Google+ user profile? (i.e. will it affect the PageRank of already indexed page or have any other unforeseen negative effects on new and indexed pages?)
Why do I not see more people linking with Google’s “prettified” version:
http://profiles.google.com/clarky.y2k?rel=author
Are there any drawbacks to using the “prettified” version of this method?
Ideally, I would like to use the intermediate PHP script, as I have already described above (see part 1). However, any tips, suggestions or other ways you may have implemented on your websites are very welcome!
For item (1), you can maintain your own app's profiles (author.php in your case) for your authors. On your own app's profile page (author.php), you would add a link from that page to Google and specify the rel="me" attribute on that link. So Alice's profile page might say something like "Find Alice on Google+.
This indirect authorship linking is supported. You also will need the link from Alice's Google+ profile that lists her as a contributor to your site. Once the linking is setup in both directions, authorship can start to show up. Authorship won't always display in all cases and can take some time for it to start appearing as Google would need to reindex your pages.
For item (2), I don't think the profiles URL will enable authorship. Some people use that URL as a vanity URL, but as far as I know it isn't supported for use with things like authorship, badges, etc.
You should test if your redirects are followed using the Rich Snippets Testing Tool: http://www.google.com/webmasters/tools/richsnippets
rel="author" is no longer supported.

Tweeting as different user using REST API

I'm currently writing a shop-related site that has it's own community in different social networks. While posting to VKontakte and Facebook is less of an issue (I can understand the concept of "group", and VK actually has an option to write posts using the group's name), Twitter is more troublesome.
Two questions:
Is there even such a thing as "groups" in Twitter? The closest I have seen is lists and timelines, but neither appears to solve my issue.
I cannot give the operator access to the twitter account. VK has a specific option when posting in a group to use that group's name as poster name. How does this work in Twitter?
I need something akin to what lamoda has set up. (It appears to be a user, and every post is labeled as written by that user, however I doubt they give their ops access to the actual twitter account).
P.S.: I'm already done with getting past OAuth and using REST to actually post, thus no code provided. I'm just having trouble with the statuses/update.json call, if that's what I should actually be using.
Talk about simple solutions to simple problems.
It appears I have been overcomplicating. There are no groups in twitter, or even comments at that. You can only post to your own feed or re-post from somebody else's.
Posting to someone's feed (a shop account's, say) is simple enough using that account's pre-generated access token which can be stored in the configs.

Finding Twitter users with follower count = MAX_FOLLOWER

I have been looking at finding Twitter users with followers more than MAX_FOLLOWER (any number set up by programmer).
I visited the twitter API and found I can search via q="keyword" but could not find any way where I can have a search in API using followers_count >= MAX_FOLLOWER
Tried looking some methods at https://dev.twitter.com/tags/finding-users as well but they were not really helpful as I could not find exactly what I am looking for.
Even for oAuth stuff, I tried creating a URL after creating a signature but still not able to consume that.
From the signature base string if I copy the url and decode it for addreess bar and send the request it says page does not exist. So looks like I am not even able to consume the services properly.
My end result will be I want a list of users who have followers_count more than MAX_FOLLOWER and then I can do a new query on those users.
I have been trying this stuff for over 4-5 hours and totally clueless where I am doing wrong or how to proceed. Read a lot of twitter api docs but nothing I could find was useful in my case.

Resources