Messaging

Last year, Bandwidth hosted a Tadhack, a global hackathon each year focusing on new trends in all things communication. The biggest theme was integrating our APIs to other APIs (Wikipedia, Watson, Ad servers, etc..). One of the winners was Roman Myers (Website, Github) with his text-to-wikipedia hack called WPCatFacts.

ro

WPCatfacts

Originally meant to fetch facts and photos about cats, Roman’s hack turned out to be much more powerful. Simply text a topic and get back the first blurb of the wikipedia article. Then, text the topic followed by picture and get back the related picture for that article.

The integration with Bandwidth is fairly straight forward. Get the message content in the text body, run the lookup in Wikipedia, determine to send picture, then send it out.

Wikipedia API

Oddly enough, Wikipedia doesn’t have a great JSON article API. The wikipedia API returns something dubbed ‘Wiki markup’. Wiki markup, is anything but consistent.

There is no commonly accepted standard wikitext language. The grammar, structure, justification, keywords and so on depend on the particular wiki software used on the particular website.

Different Wiki programs may support use of different sets of HTML elements within wikitext. In some cases, permitted HTML elements may be configured by individual wiki sites. MediaWiki supports many common HTML tags.

Fortunately, there are a few different libraries written for Node up on NPM to help out with the formatting and oddness. For this case, Roman went with WTF-Wikipedia. About a year later, wtf-wikipedia is still maintained and updated on a somewhat regular basis.

Results

https://twitter.com/bandwidth/status/610193303741538304/photo/1

Out of all the hackathon teams Roman won the ‘Best College Hack’ on a team by himself.

You can see the code for WPCatFacts on Github.

Sign up for a Bandwidth account by following the link to right -> or clicking here

