I’ve been on a bit of a “Social Authority” (or “Influence” depending on what side of the fence you are on…) kick lately. I’ve been playing with some different social scoring APIs and having a little fun with them.
I came across Kred quite a while ago. The service has come a long way in the last few months, and I’ve noticed some major performance and design improvements on the site. This prompted me to give the API a second look, and see what I could come up with.
Let’s say that all I want is to get a Twitter users Kred Influence Score and Outreach Score. Perhaps you want to do some quick research on a client or competitor.
First – you’ll need to register an app and get your app ID and app key. Do so at https://developer.peoplebrowsr.com/
Next, we’ll need to build our API call. My weapon of choice is PHP, but you could certainly use Python or Ruby.
$app_id = "App_ID"; $app_key = "App_Key"; $user = "Twitter Username"; $URL = 'http://api.kred.com/kredscore?app_id='. $app_id .'&app_key='. $app_key .'&term='. $user .'&source=twitter'; $kred_response = json_decode( file_get_contents( $URL ), true );
We now have our response. It looks something like this:
As you see, the Kred Influence and Outreach scores are there, we just need to grab them!
$kred_score = $kred_response['data']['influence']; $kred_outreach = $kred_response['data']['outreach'];
I have found that the API sometimes hangs, and can hold up the rest of your page. If you are not using AJAX to get the Kred Influence, then make sure you set a timeout.
That’s pretty much it – really straight forward. If you want to see this in action, head over to http://mysocialauthority.com and enter your Twitter username.