As more and more people are enjoying opened golf courses right now, we want to share some learnings from the Twitter Data Partner Cup that we hosted last fall. The format was a 'shotgun scramble' golf tournament in Los Angeles, CA meant to celebrate a few of Twitter’s Data partners and their customers for a day of fun on the links. If you are unfamiliar with the scramble format, each member of a four-person team tees off and the team repeatedly picks the best shot until the hole is completed. With a 'shotgun' start, there are 18 teams that begin play simultaneously – each starting on a different hole. For example, team 8 starts on hole 8.
With most non-professional golf tournaments, the team scores are typically not known until the very end when the scorecards are turned in. How cool would it be to get real-time score updates during the game? We saw this as an opportunity to create a tool that would allow for a live scoring system. This system could enable teams to submit their scores from the course as holes are completed, and the compiled scores could be shared via a live leaderboard, helping to fuel the competition.
As members of the Twitter Developer Relations team, we felt up for the challenge to build such a scoring system with the Twitter platform. We began prototyping a solution during a company hackweek. We first sketched out a technical design for a system where:
It became clear that we'd be building a Twitter chatbot, where private messages (Direct Messages) provide the main communication channel, while also having the ability to communicate with public Tweets.
When we thought about the features we'd want for such an app, these surfaced as the main features:
With these design goals in mind, we began to build with the following Twitter API endpoints, which provide the foundation for any Twitter chatbot:
Even though we were testing and debugging up until the night before the event (like any hackweek project), we are happy to report the leaderboard app worked nearly flawlessly. The ability to see how other teams were scoring added to the excitement as the event progressed. Seeing notifications of other team's subpar holes added to the "what's happening now?" experience.
The main day-of-show challenge was spotty cell coverage out on the course. It's definitely recommended to test coverage at the event location beforehand. Also, in some cases, there clearly was not enough training on how to submit scores correctly the first time (we will not name names). Finally, we built the app to Tweet only when teams scored a Birdie (one under par). While Eagles (two under par) were not expected, they happened several times and were not Tweeted about. More sadly, there was a hole-in-one that went completely unacknowledged in real-time. Next time, we’ll be sure to account for these rare events and notify the audience!
Not into golf? That's OK. Keep in mind that the framework used here to support a live golf scoring system is general enough for other use cases. This design could be used for a variety of other scenarios like scavenger hunts and other sports tournaments, such as soccer and bowling. Beyond shared sporting events, these patterns can support private polls by receiving private votes and rankings and publicly sharing compiled results at their completion.
The next time you’re planning a tournament or friendly game, think of Twitter.
The @HackerScorer chatbot was developed in Python using Flask. See the project's GitHub repository for more details.
If you want to learn more about how this live scoring app was developed and deployed, see our code-driven blog post about this prototype. This blog post is split into four parts, focusing on getting started with Twitter chatbots, designing the chatbot experience, developing the database-driven scoring system, and generating leaderboard graphics in real-time.