Last month I wrote about Inbox Influence, a plugin for Gmail that highlights the political influence of people, companies and politicians mentioned in your emails. Gmail is just one example of a context where it makes sense to attach political influence data to text. (Another is news stories–see Poligraft.) But what about Yahoo Mail and Hotmail? What about Outlook and Thunderbird? What about RSS readers, PDF viewers and word processors? What about integrating political influence data into server-side systems such as blog engines and content management systems? Sunlight Labs can’t do it all, which is why creating tools and APIs for developers is one of our primary missions. Indeed, nearly all of our products–including Inbox Influence–are powered by public APIs.
Although extremely powerful, the Influence Explorer Text API is quite simple. There’s only one endpoint and it takes only one parameter, the text to process. A variety of influence data is returned, most of which should be self-explanatory. Here’s an example from a recent new article:
Last year, as [Rep. Darrell Issa] began recruiting for his committee, he selected Peter Warren, a lobbyist for the student loan industry. Warren had been president and executive vice president of government affairs of the Education Finance Council (EFC), a trade association for student loan companies and nonprofits, since 2004.
Submitting this text to the endpoint
with a valid API key and the text in the
text parameter returns
There’s a lot of information here, so I’ll just point out some highlights. You can see that Darrell Issa is a member of the House (
entity_data.seat_label) and that he’s raised $4.7M over his career (
entity_data.campaign_finance.contribution_total). Peter Warren is listed a registered lobbyist (
entity_data.lobbying.is_lobbyist) who worked for the Education Finance Council. The Education Finance Council lobbies on education issues (
entity_data.lobbying.top_issues) and gives about two-thirds of its campaign contributions to Republicans (
Each entity match returns both the standard name (
entity_data.name) and the exact string matched in the text (
matched_text), as well as the type of entity (individual, organization or politician) and various metadata. Each entity also includes the Transparency Data ID, which can be used to pull back lots more information from our Transparency Data API.
The API comes with the important caveat that the name matching is far from perfect. Variations in the names of people or companies can easily cause the match to be missed. And when matching person names, there’s no guarantee that the “John Smith” referred to in the text is the same “John Smith” found in our database.
We’ll be making improvements and additions to the API over the coming months. So if there’s something that doesn’t work right or some other data that you’d like to see included please send us a comment or strike up a discussion on our Google Group. And of course we’d love to hear about anything you build with the API!