Building a Bot to Monitor Politicians' Twitter Accounts

By: Sérgio Spagnuolo | 03/22/2019
A new tool from ICFJ TruthBuzz Fellow Sergio Spagnuolo and Aos Fatos makes it easy to search tweets from Brazil's new president.

Journalists and newsrooms can create a tool to track tweets from politicians, or other prominent leaders, relatively easily. Check out the tutorial ICFJ has prepared about the process.

It’s important to know what politicians are saying on Twitter. After all, tweeting, it seems, is the new way of conducting politics. Elected officials often float ideas on the social media platform to elicit feedback — kind of like a focus group survey. Or, they use their reach to influence political debate.

While much smaller than Facebook, Twitter has gained a stronger foothold in politics over the past 10 years — changing the way politicians communicate with the people, the media and among themselves. Facebook has more than 2 billion active users, while Twitter has 320 million.

It’s no secret that U.S. president Donald Trump often uses Twitter to push his political agenda. While he is, perhaps, the most prominent politician doing so, he is far from the only one. Brazilian President Jair Bolsonaro, for instance, actually announced the appointment of his Minister of Education through Twitter before taking office.

Twitter can also be a way for politicians to respond to criticism. U.S. representative Alexandria Ocasio-Cortez has used Twitter to expand her policy proposals and to reaffirm her policies and positions, but also to hit back when criticized.

“Twitter’s basically used by politicians to influence other influencers. It’s a very small universe of people, but it’s people who can move an agenda,” John Parmelee, author of the book, “Politics and the Twitter Revolution,” told The Guardian in 2016.

Given the relevance Twitter has gained in politics, it’s important we know what elected officials are publishing on the site, and that we keep a detailed, searchable record of their posts.

This is why Aos Fatos, the Brazilian fact-checking organization, in partnership with the International Center for Journalists (ICFJ), developed a bot to monitor Bolsonaro’s Twitter account.

Using a combination of tools such as Workbench and Google Sheets, we were able to build a database — in both Portuguese and English — of more than 5,000 tweets penned by Bolsonaro dating back to 2010 (his older tweets were kindly scraped by the data agency, Novelo). The database allows people to easily search through the Brazilian president’s tweets, and keeps a historical record of the posts he has made over time.

With this initiative, which is part of the TruthBuzz program at ICFJ, we are building a way for people to access information themselves, without needing a journalist to act as an intermediary. This is important because, when Aos Fatos or other media companies are asked about the source of their content and its context, which is frequently Bolsonaro's Twitter account, it’s easy to look for evidence, even for older reports.

The Aos Fatos tool also keeps a record of all of Bolsonaro's tweets, even if they are deleted. This sheds a light into the past and current thinking of the president and gives transparency about his positions — especially regarding tweets published during his presidency, making him accountable for the statements he makes.

The tool relies on Workbench's API to monitor the data from Twitter, and Workbench’s team told Aos Fatos that they will enforce Twitter's rule of erasing tweets if they are deleted from Twitter and the owner of the account asks to do so. However, we keep regular backups of the data to prevent tweets from being erased.  

This is well in line with other projects in the U.S. and other countries to preserve historical records produced by elected officials. One of the most well-known examples is Politwoops, a project that tracks deleted tweets by candidates and elected officials, with chapters in the U.S., U.K., European Union and Australia. After some quarrel with Twitter, the project was allowed to continue.

Main image screenshot from Aos Fatos' online tool. This story was first published on IJNet.

News Category
Country/Region

Latest News

ICFJ se Suma a Otras 9 Organizaciones Internacionales Para Presentar un Amicus Curiae en el Caso del Periodista Guatemalteco Encarcelado José Rubén Zamora

Un grupo de 10 organizaciones internacionales presentó esta semana un amicus curiae ante la Corte Suprema de Justicia de Guatemala en el caso del periodista José Rubén Zamora Marroquín. El amicus, presentado el 26 de marzo, argumenta que el retorno de Zamora a prisión preventiva constituye una violación de sus derechos fundamentales bajo el derecho guatemalteco e internacional, e insta a la Corte a otorgar un recurso de amparo pendiente y permitir que el Sr. Zamora lleve su proceso bajo medidas sustitutivas.

ICFJ Joins 9 Other International Organizations in Submitting Amicus Brief in Case of Imprisoned Guatemalan Journalist José Rubén Zamora

A group of 10 international organizations submitted an amicus curiae brief to Guatemala’s Supreme Court in the case of journalist José Rubén Zamora Marroquín. The brief, filed on March 26, argues that Zamora’s return to preventive detention constitutes a violation of his fundamental rights under Guatemalan and international law, and urges the Court to grant a pending amparo appeal and allow Zamora to return to house arrest.

Press Freedom on Campus: Why it Matters and What Student Journalists Need Most

In February, ICFJ partnered with Vanderbilt University and Freedom Forum, with support from the Lumina Foundation, to bring university faculty and students, international and U.S. journalists, and media leaders together for a discussion about the importance of press freedom in democratic societies. Participants stressed how U.S.-based journalists can learn from the experiences of their colleagues abroad, and they dived into the challenges campus reporters face, such as a lack of funding and harassment from fellow students, offered advice for engaging audiences, and more.