Twitter Mailing Lists…

I’m not sure if this app already exists, but it struck me it might be useful for conferences/events – a broadcast Twitterlist that subscribers can send short messages to. (I donlt have time to try to build this, unfortunately.)

So what do we have available to us at the moment?

Hashtags allow communities to come together in an ad hoc way around an event. If you want to keep track of the event’s activities, subscribe to a search on the hashtag. The downside? If you aren’t following the hashtag, then if you aren’t following the people using the hashtag, you won’t see the tweets.

Twitter lists pull together a list of Twitter users and let you see tweets from all of them. So if we run an event and get participants’ Twitter IDs, we can generate a list of participants to provide a single point of access to follow those particpants. For greater salience, we could also run the feed through a hashtag filter, so we only get to see tweets from those participants tagged with the event hashtag. (Note to self – I need to create a “generate list of hashtaggers” from the hashtag community app.)

But a question now arises – what if I can’t rely on every in the event follow the list or hashtag. What if I want to actually send a message to each and every person on the list? That is, what if I want to spam the members of the list?

How about this recipe: create a private Twitter user ID for the event. Encourage event attendees to follow that user (and follow them back) and don’t accept anyone else. Set up an autoresponder that works along the lines of the following. Suppose @follower7 sends:
d eventID BROADCAST: This is the spam message…
Then for every other follower, @eventID sends them a personal message:
@follower1 @follower7 says: “This is the spam message…”
@follower2 @follower7 says: “This is the spam message…”

Of course, Twitter may see this as a spambot and delete it. (If the bot just sends out DMs, does this go under the radar?) However, I prefer to see it as the equivalent of a mailing list…

What’s Happening Now: Hashtags on Twitter Lists

So over the last few days, there’s been so much chat around the roll out of official Twitter lists that some people have probably even blogged about them. Ad hoc lists (aka ‘groups’) have been available for some time on a variety of twitter clients, of course, but now there’s ‘central support’ so it seems like everyone is hyping around them (OMG, OMFG, Twitter has lists. Lists! etc.)

I’m still waiting on the API (though a draft spec has been posted) so I can have a go at creating lists automagically from hashtag groups (various posts), but in the meantime, here are a couple of little toys that try to spot what’s going on within the context of a particular list.

First up, a pipe that will look to see what hashtags are being used by folk on a particular list. The pipe feeds off a list of tweets by list members (using the URI pattern http://twitter.com/USERNAME/lists/LISTNAME/statuses.xml ) [UPDATE: it now uses URLs of the form https://api.twitter.com/1/lists/statuses.json?slug=LISTNAME&owner_screen_name=USERNAME&per_page=100&page=1& (not shown in the screenshot below)] and then reuses pipework from Searching for Twitter Hashtags and Finding Hashtag Communities, replacing the search elements with a list feed:

So what? So you can enter the URI of a list and see what hashtags folk on that list have been using recently – Twitter list hashtags pipe:

A second, related pipe (this time reusing the Twitter name search pipe (that looks for people who’ve been tweeting particular search terms) and the Twitter names atomiser (i.e. tokeniser) pipe) will look for the names of folk who are part of a recent conversation on the list by virtue of being @d at… Twitter list conversants pipe:

One thing to note about each pipe – make sure you enter the URI in the correct form – http://twitter.com/USERNAME/lists/LISTNAME

If I get a chance, I’ll harden the pipe with a regexp to defend against the missing lists path element; but at the moment, if you donlt use the correct the URI pattern, the pipe will break…

That’s all…

PS the pipe should be hardened now to accept URIs of the form http://twitter.com/USERNAME/LISTNAME

[UPDATE: the pipe now requires you to enter a userna,me and the listname/slug]

PPS I’d forgotten I’d written this post/already built a pipe to do it, so I ended up creating another one… hashtags used by list participants pipe. This one does a couple of different things to the pipe mentioned above: it changes all the tags to lower case, thus removing ambiguity in capitalisation; it uses a twitter API parameter to search over the last 250 tweets sent by list members).

Twitter Gardening – Pruning Unwanted Followers

Some people like to keep their Twitter follower network under control, whilst others are happy to accept all-comers (ahem), but using the default Twitter web page to track of who amongst your new followers may be a spammer is not all that convenient…

So here’s the simplest of gardening tools for helping keep those unwanted followers under control: simple Twitter gardening tool; to see your own friends and followers, you’ll need to edit the URL. Click through the link, then in the browser address/location bar look for psychemedia, and change it to your twitter name….

[UPDATE – reminded of this hack by Brian Kelly’s August 2012 post on “unwanted” Twitter Followers, I noticed that the single page web app described in this post has long since rotted… here’s a stop gap: Twitter gardening tool, though I may take it off that URL in the next day or two… ]

The tool is very simple (I’ll post the how to later) and simply pulls in details about the most recent of a named person’s followers, along with a count of their number of followers, friends and updates.

The tabular view lets you explore the ‘quality’ of your Twitter friends and followers based on 3 metrics:

  • the number of their friends;
  • the number of their followers;
  • the number of their updates;

A form based interface may be incorporated one day – for now, you have to go via the URI, which looks something like this:

e.g. http://ouseful.open.ac.uk/dataTableDemo2.php?
u=YOUR_TWITTER_ID&p=1&min_fr=200&min_fo=600&sp=5

The URI arguments as follows:

  • u: Twitter username
  • p: results page (0 gives 100 most recent friends/followers, 1 gives the 101st to 200th most recent friends/followers, etc; if less than 100 people are displayed in any view, it’s because Twitter has blocked them…)
  • min_fr: min no. of friends for ‘Min Network Size’ view
  • min_fo: min no. of followers for ‘Min Network Size’ view
  • sp: min fr/fo ratio for ‘Spammers?’ view

To order the rows by column, simply click on the column heading (once for an ascending view, a second time for the descending view).

By default, the app will only pull in the 100 or so most recent friends/followers (actually – it may be less than that; each 100 is based on following accession (I think) so there will be gaps corresponding to personally or automatically blocked followers).

If you click on ‘Get Next 100 friends/followers’, the next page of followers will be pulled in and added to the table.

A couple of spam follower detecting heuristics are included. The “Spam?” view will display followers whose friend/follower ratio is greater than the specified number (you can set that value via the URI). Another view shows people with a network size above a minimum number of friends and followers (again, those values can be set via the URI). Simply viewing the whole table ordered by decreasing numbers of followers can also detect spammers.

To block a follower, clicking on the name link will take you to their Twitter page. If you’re logged in to Twitter, you should be able to block the follower.

Note that if you’ve loaded lots of pages of followers in, click out to Twitter personal page, and back to the Twitter Gardening page, you’ll lose all but the first 100 or so followers from the table. So a tip: right click on the link and open the Twitter personal pages in a new tab ;-) Work through the table, opening potential spammer pages in a new tab if required, then review the tabs one at a time…

Here’s the link again: simple Twitter gardening tool. Remenber, all you need to do is click through the link, change psychemedia in the URL to your Twitter ID, and refresh the page to analyse your friends and followers.

See also: Brand Association and Your Twitter Followers and associated comments for a discussion about personal Twitter network management.

Searching for Twitter Hashtags and Finding Hashtag Communities

Over the last few weeks I’ve been messing around more than I should with Twitter, and in particular trying to get a feel for how we might use hashtag communities as a well of identifying and growing community structures in a particular topic area (see posts all over OUseful.info for more details).

A couple of days ago, @clarileia raised the question of how you find new hashtags, so I had a little tinker today putting together a couple of hacks (Twitter hashtag search pipe and Twitter my network hashtags) that let you identify recently used Twitter hashtags associated with a particular search term, or with a specified user’s recent friends or followers.

Twiitter hashtag search http://pipes.yahoo.com/ouseful/twitterhashtagsearch

[Note: at the time of writing, Pipes appears to be running a little slow… if the Pipe appears to stall, it does work, honest… try it again later ;-)]

At the core of all the hacks is a clunky hashtag tokeniser pipe that takes a Twitter status update and pulls out the hashtags:

This utility pipe works by taking the status update, extracting the hashtags using a hacked together regular expression, splits the separate hashtags into separate feed items, and then filters them to emit only legitimate hashtags.

The utility pipe is then used in a search powered pipe, which searches twitter for the 100 most recent tweets containing the search terms and then scans those for hashtags; and a ‘personal network hashtags’ pipe that takes a Twitter username, pulls back the tweets from their one hundred most recent friends, and their one hundred most recently followers, and then scans those tweets for hashtags.

For example, here’s the search pipe:

Both pipes have a common output routine – the list of hashtags is filtered through the Unique block, which also returns a count of how many times each hashtag has appeared. The hashtags are then ordered and filtered according to the minimum number of required occurrences in the sample. A regular expression adds the number of occurrences of each hashtag.

The pipes could be extended to pull in more search results, or more followers/friends (maybe the first hundred friends/followers as well as the most recent hundred?) but that’s left as an exercise for the reader. As for the use case – I dunno? Maybe integration with the OUseful TwitterMyHashtag apps? Or perhaps @clarileia had a use case in mind?!;-)

PS thanks to PJ on the Yahoo Pipes team for getting back to me earlier today when I was struggling with a slow running pipes editor… I’m now totally reliant on Pipes for many apps, and especially for rapid the majority of my prototyping, so when Pipes is slow, I feel as happy as if I’ve lost an unbacked up server… Brian Kelly would probably tell me I need to do a risk assessment… I’ve already done one: What Happens If Yahoo! Pipes Dies? – but I haven’t made a start on the contingency stuff that was considered there…

Personal Twitter Networks in Hashtag Communities

Another conference I’m not at, this time ALT-C, so time for another blatant attempt to raise my profile at the event even if I’m not there with another Twitter related hack…;-) This time, a little tool to help you explore the extent of your Twitter network within a community of people using a particular hashtag.

Here’s a tease of the sort of report it gives:

My place in a Twitter hashtag community http:ouseful.open.ac.uk/twitterMyhashtagNet.php?q=psychemedia&h=altc2009

Some numbers (I’ll let you know what in a minute…) A list of people in the hashtag network who are followed by a particular individual (their “friends”). A list of people in the hashtag network who follow a particular individual, but are not followed (friended) back (their “serfs”). A list of people in the hashtag network who are followed (friended) a particular individual, but do not follow them (their “slebs”). A list of people in the hashtag network who neither follow nor are followed (friended) by a particular individual (“the void”).

Before I go on, I should probably also define what I mean by a hashtag community, not last because there are some, err, pragmatic constraints on defining this;-)

For the purposes of this post, a hashtag community is a collection of people who have used a particular hashtag more than a certain minimum specified number of times in a set of Twitter posts that use the hashtag. In my default ad hoc set up, I tend to look for people who have used the hashtag more than 3 times in the most recent 500 or so tweets. For the proof of concept demo, I also limit the size of the hashtag network to 100, otherwise the pipework that underpins it starts to fall over…

UPDATE:
Here’s a bit more explanation about why the app doesn’t always show people in the community you ‘know’ to be there…

You may notice that not everyone you know has used the hashtag appears in the friends and followers lists. This is because the size of the hashtag community is limited in three ways:

  • hashtag use sample size: for this proof of concept, the hashtag community analysis is based on a Twitter search that grabs the 500 most recent uses of the declard hashtag. If this were a production tool, it would pull the complete archive of hashtag use from one of the twitter archiving services. if you want that feature, build it yourself…;-)
  • minimum number of tweets: an optional paramenter in the URI identifies the minimum number of hashtagged tweets that a user must have sent in the sample to be considered a member of the community. By setting this numbr large, it allows you to just see the heaviest hashtagger in the community, or filter out people who maybe just use the hashtag once in a retweet. (I think there’s a bug in the code – if you set this mintweets paramter to 2, the user must have hashtagged at least 3 times. i.e. one more. 10 is 11.
  • Max community size: an ‘issue’ in the Twitter search API means I need to call the Twitter API once for every person in the community. This overhead can break the pipework, so the community size can be limited arbitrarily.

The inspiration for the report is a typical ego thing – to what extent is my personal Twitter network dominated by the membership of a particular hashtag community. (Note I’ve explored related ideas in a variety of other ad hoc ways: Who’s Tweeting Our Hashtag?, Where Next With The Hashtagging Twitterers List?, Preliminary Thoughts on Visualising the OpenEd09 Twitter Network, A Quick Peek at the IWMW2009 Twitter Network, More Thinkses Around Twitter Hashtag Networks: #JISCRI and Handling Yahoo Pipes Serialised PHP Output).

Anyway, in the current example, the numbers I’ve started to look at are defined as follows. All numbers are either integers, or real numbers in the range 0..1.

So what do the numbers mean?

  • Number of hashtaggers: the number of people in the hashtag network, Ngalaxy;
  • Hashtaggers as followers (‘hashtag followers’): the number of people in the hashtag community who are following the named individual, Gfollowers
  • Hashtaggers as friends (‘hashtag friends’): the number of people in th hashtag community that the named individual has friended, Griends
  • Hashtagger followers not friended (‘serfs’): the number of people in the hashtag community that follow the named individual but that are not followed back (i.e. who are not friends of the named individual), Gserfs
  • Hashtagger friends not following (‘slebs’): the number of people in the hashtag community that are followed by the named individual (i.e. friends) but that do not follow them back (i.e. who are not also followers of the named individual), Gslebs
  • Hashtaggers not friends or followers (‘the hashtag void’): the number of people in the hashtag community who neither follow, nor are friended by, the named individual Gvoid
  • Reach into hashtag community: the proportion of the the hashtag community that follow the named individual; a measure of the extent to which an individual can reach the hashtag community without actually using the hashtag; Greach=Gfollowers/Ngalaxy.
  • Reception of hashtag community the proportion of the the hashtag community that are followed by (i.e. are friends of) the named individual; a measure of the extent to which an individual sees messages from the hashtag community without directly tracking the hashtag; Greception=Gfriends/Ngalaxy
  • Hashtag void (normalised): the size of the void normalised relative to the size of the hashtag community; the proportion of the hashtag community that are unlikely to be directly encountered outside of the hashtag community; Normvoid=Gvoid/Ngalaxy
  • Total personal followers the total number of followers of the named individual, Nfollowers
  • Total personal friends: the total number of friends of the named individual Nfriends
  • Hashtag community dominance of personal reach: the extent to which the hashtag community dominates the set of people who follow the named individual, Domreach=Gfollowers/Nfollowers. If all the named individual’s followers are in the hashtag community, Domreach=1. If none of them are, Domreach=0.
  • Hashtag community dominance of personal reception: the extent to which the set of the named individual’s friends is dominated by members of the hashtag community, Domreception=Gfriends/Nfriends. If all the named individual’s friends are in the hashtag community, Domreception=1. If none of them are, Domreception=0.

If you want to try the tool out, the interface is provided by the URI:
http://ouseful.open.ac.uk/twitterMyhashtagNet.php?q=ostephens&h=altc2009&mintweets=2&maxusers=99

I have no idea whether any of these measures are used in more formal analyses (I’ve yet to start my formal reading of the proper social network analysis stuff…) but it’s a way in for me to start thinking about what measures that might be in some sense meaningful and both easy to explain and calculate;-)

Handling Yahoo Pipes Serialised PHP Output

One of the output formats supported by Yahoo Pipes is a PHP style array. In this post, which describes a way of seeing how well connected a particular Twitter user is to other Twitterers who have recently used a particular hashtag, I’ll show you how it can b used.

The following snippet, (cribbed from Coding Forums) shows how to handle this array:

//Declare the required pipe, specifying the php output
$req = "http://pipes.yahoo.com/ouseful/hashtagtwitterers?_render=php&min=3&n=100&q=%23jiscri";

// Make the request
$phpserialized = file_get_contents($req);

// Parse the serialized response
$phparray = unserialize($phpserialized);

//Here's the raw contents of the array
print_r($phparray);

//Here's how to parse it
foreach ($phparray['value']['items'] AS $key => $val)
	printf("<div><p><a href=\"%s\">%s</a></p><p>%s</p>\n", $val['link'], $val['title'], $val['description']);

The pipe used in the above snippet (http://pipes.yahoo.com/ouseful/hashtagtwitterers) displays a list of people who have recently used a particular hashtag on Twitter a minimum specified number of times.

It’s easy enough to parse out the Twitter ID of each individual, and then for a particular named individual see which of those hashtagging Twitterers they are either following, or are following them. (Why’s this interesting? Well, for any given hashtag community, it can show you how well connected you are with that community).

So let’s see how to do it. First, parse out the Twitter ID:

foreach ($phparray['value']['items'] AS $key => $val) {
	$id=preg_replace("/@([^\s]*)\s.*/", "$1", $val['title']);
	$idList[] = $id; 
}

We have the Twitter screennames, but now we want the actual Twitter user IDs. There are several PHP libraries for accessing the Twitter API. The following relies on an old, rejigged version of the library available from http://github.com/jdp/twitterlibphp/tree/master/twitter.lib.php (the code may need tweaking to work with the current version…), and is really kludged together… (Note to self – tidy this up on day!)

The algorithm is basically as follows, and generates a GraphViz .dot file that will plot the connections a particular user has with the members of a particular hashtagging community:

  • get the list of hashtagger Twitter usernames (as above);
  • for each username, call the Twitter API to get the corresponding Twitter ID, and print out a label that maps each ID to a username;
  • for the user we want to investigate, pull down the list of people who follow them from the Twitter API; for each follower, if the follower is in the hashtaggers set, print out that relationship;
  • for the user we want to investigate, pull down the list of people who they follow (i.e. their ‘friends’) from the Twitter API; for each friend, if the friend is in the hashtaggers set, print out that relationship;
$Twitter = new Twitter($myTwitterID, $myTwitterPwd);

//Get the Twitter ID for each user identified by the hashtagger pipe
foreach ($idList as $user) {
	$user_det=$Twitter->showUser($user, 'xml');
 	$p = xml_parser_create();
	xml_parse_into_struct($p,$user_det,$results,$index);
	xml_parser_free($p);
	$id=$results[$index['ID'][0]][value];
	$userID[$user]=$id;
	//print out labels in the Graphviz .dot format
	echo $id."[label=\"".$user."\"];\r";
}

//$userfocus is the Twitter screenname of the person we want to examine
$currUser=$userID[$userfocus];
 
//So who in the hashtagger list is following them?
$follower_det=$Twitter->getFollowers($userfocus, 'xml');
$p = xml_parser_create();
xml_parse_into_struct($p,$follower_det,$results,$index);
xml_parser_free($p);
foreach ($index['ID'] as $item){
	$follower=$results[$item][value];
	//print out edges in the Graphviz .dot format
	if (in_array($follower,$userID)) echo $follower."->".$currUser.";\r";
}

//And who in the hashtagger list are they following?
$friends_det=$Twitter->getFriends($userfocus, 'xml');
$p = xml_parser_create();
xml_parse_into_struct($p,$friends_det,$results,$index);
xml_parser_free($p);
foreach ($index['ID'] as $item){
	$followed=$results[$item][value];
	//print out edges in the Graphviz .dot format
	if (in_array($followed,$userID)) echo $currUser."->".$followed.";\r";
}

For completeness, here are the Twitter object methods and their associated Twitter API calls that were used in the above code:

function showUser($id,$format){
	$api_call=sprintf("http://twitter.com/users/show/%s.%s",$id,$format);
  	return $this->APICall($api_call, false);
}

function getFollowers($id,$format){
  	$api_call=sprintf("http://twitter.com/followers/ids/%s.%s",$id,$format);
 	return $this->APICall($api_call, false);
}
  
function getFriends($id,$format){
  	$api_call=sprintf("http://twitter.com/friends/ids/%s.%s",$id,$format);
 	return $this->APICall($api_call, false);
}

Running the code uses N+2 Twitter API calls, where N is the number of different users identified by the hashtagger pipe.

The output of the script is almost a minimal Graphviz .dot file. All that’s missing is the wrapper, e.g. something like: digraph twitterNet { … }. Here’s what a valid file looks like:

(The labels can appear either before or after the edges – it makes no difference as far as GraphViz is concernd.)

Plotting the graph will show you who the individual of interest is connected to, and how, in the particular hashtag community.

So for example, in the recent #ukoer community, here’s how LornaMCampbell is connected. First a ‘circular’ view:

ukoerInternalNetLMC2

The arrow direction goes FROM one person TO a person they are following. In the circular diagram, it can be quite hard to see whether a connection is reciprocated or one way.

The Graphviz network diagram uses a separate edge for each connection and makes it easier to spot reciprocated links:

ukoerInternalNetLMC

So, there we have it. Another way of looking at Twitter hashtag networks to go along with Preliminary Thoughts on Visualising the OpenEd09 Twitter Network, A Quick Peek at the IWMW2009 Twitter Network and More Thinkses Around Twitter Hashtag Networks: #JISCRI

More Thinkses Around Twitter Hashtag Networks: #JISCRI

A brief next step on from Preliminary Thoughts on Visualising the OpenEd09 Twitter Network and A Quick Peek at the IWMW2009 Twitter Network with a couple of graphs that look at the hashtag network around the JISCRI event that’s going on this week.

The sample was a taken from a search of recent #jiscri hashtagged tweets captured last night using the Hashtag Twitterers pipe.

The first chart was to look at people who the hashtag twitterers were following in large numbers who weren’t using the hashtag (I think…my experimental protocol was a bit ropey last night… oops).

The graphs were plotted using Graphviz – firstly a radial plot:

jiscrinetExtGurus

And then a circular one:

jiscrinetExtGurus2

The circular one is quite fun, I think? :-) At a glance, it shows who the “external gurus” are, as well as the differences in their influence.

The second thing I looked at was the network graph of the JISCRI hashtaggers, showing who friended whom:

jiscriTwitterNet

Here’s the circular view:

jiscriTwitterNetCircular

For a large event, I think this sort of graph could be quite fun to generate at both the start of the event and at the end of the event, to show how connections can be formed during an event.

For conferences that publish lists of attendees, popping up a poster of the delegates’ twitter network might provide an interesting discussion thing for people to chat around.

PS See also Meet @HelloApp, Making Conferences More Fun.