I applied for a Twitter Developer’s account while I was trying to solve a problem I had with one of my Lists. The API couldn’t fix my problem. I thought to myself since I have this access, what other issues can I solve? Then came Spaces.

I am an Android user, and discovering relevant Twitter Spaces that meet my specific requests is challenging. Also, there is no dedicated discovery channel for Spaces on the web. Thus, I opted to solve this problem using the “Search Spaces” endpoint.

That was the genesis of link.

What it does

Tweet Spaces enables anyone on the internet to discover engaging Twitter Spaces that are scheduled or happening now, all with a search term (e.g., Nigeria), Hashtag (e.g., #election), or a username (e.g., @elonmusk). Hit the search button and scroll through the result.

Spaces currently "live" are displayed on green background, while Spaces that are "scheduled" are shown on a grey background.

Spaces hosted by users with private Profiles are excluded front he result due to the limitation on their user information.

How i built it

Relevant Technology - Twitter API v2, Tweepy, Python, Flask, and AWS Elastic Beanstalk.

  • Started off with creating an environment on Postman for Twitter API v2
  • Studied the result structure
  • Read through the documentation on Twitter, Tweepy and Flask
  • Watched loads of Youtube videos on how various people have engaged the API and the various use-cases
  • Engaged the Twitter Developer community when I was stuck
  • Shared progress intermittently on Twitter
  • learnt how to deploy a web app on AWS
  • Setup google analytics
  • Shared with the world on Twitter

Challenges i ran into

I faced a few challenges building the solution, but two are significant.

While accessing fields in the “data” key was relatively straightforward, matching each unique Space to a host via the “Includes - user” keys was a significant challenge. However, a strong community of Twitter Developers solved this problem for me; see - link.

Some hosts have a private profile that returns "Authorization Error" - "Sorry, you are not authorized to see the user with creator_id: [xyz].” In my code, Flask returned a KeyError because the creator_id in the “data” dictionary was missing in the “include - user” dictionary. I fixed this with an if statement that checked for a match before iteration.

Accomplishments that i'm proud of

The ability to create something that solved a problem I had myself was fulfilling. Also, the solution was a first for me on many levels, the first time working with an API, the first time deploying a web app on AWS, the first time building in public, etc.

What i learned

The Twitter API is quite powerful. I discovered a few interesting use cases while I was researching on Youtube.

Personal growth for me as well; this was my first Web App. I had been on a “self-taught” programming journey, with resources on Youtube, Code Academy, and FreeCodeCamp. This project allowed me to put all my learnings to work and produce a product.

What's next for Tweet Spaces

A few improvements later this year.

  1. The landing page is static, so I plan to introduce automatic Space results based on the trending topics in different countries.
  2. There is currently no personalization, so a great addition will be for users to save a list of interesting scheduled spaces on their profile for easy access.
  3. Collect data on what people are searching for and share that with creators.

Built With

Share this project: