Deploy a Word Game in 5 Minutes with Twilio Functions
Time to read: 4 minutes
If the number of virtual social gatherings you attend regularly has increased over the past few months, you may have found yourself awkwardly ending a call when all the attendees have run out of things to talk about, or playing the same virtual party game more times than you can count, or perhaps like me you’ve just resorted to reading memes out loud to your friends. If you’re looking to inject more creativity and conversation into your calls, follow along in this post to add a new twist on an old word game to your “Virtual Happy Hour Survival Kit”. Fictionary and this SMS version, BalderText, challenge players to write convincing definitions for uncommon English words to try and trick other players.
Using Twilio Programmable SMS and Twilio Functions, this post will guide you through deploying and getting ready to play a game of BalderText in under five minutes.
Requirements
- Git or another tool to clone a repository from GitHub (If you’re using Linux or MacOS, you should have this by default)
- Node version 10 or greater, and NPM (included in the Node installation bundle).
- A free or paid Twilio account. You'll need the account SID and the auth token for your
.env
file. - A Twilio phone number. Log onto the Twilio Dashboard to view your Active Numbers. If you don’t have a Twilio phone number yet, learn how to search for and buy a number here.
- An Oxford Dictionaries API Key to fetch word definitions. You can sign up for free 'Prototype' credentials here. You'll need the Application ID and Application Key for your
.env
file.
Deploy your own game
- Clone the repository from GitHub into a directory on your system:
git clone git@github.com:eshenfield/baldertext.git
- Once you have the
baldertext
directory, runnpm install
inside of it to install the required deploy dependencies. - Rename the included
.env.example
file to.env
and replace theXXX
placeholders with the credentials you gathered above in Requirements. - Run
npm run deploy
to deploy your Baldertext instance using the Twilio Serverless toolkit. It should take a minute or two, and when the deploy is complete, it will list out the Deployment Details in your terminal. Copy the url listed under "Functions" (it should end in '/game') and save it for the next step. - From the Twilio console, configure your phone number to respond to incoming messages with a
Webhook
that makes anHTTP POST
request to the URL you saved in step 4.
- Text 'Join game' to your number to make sure everything is working!
How to play BalderText
Objective
The goal of BalderText is to write a fake definition for an uncommon word that is convincing enough that the other players believe it is the real definition. Players receive points when other players choose their fake definitions and when they successfully choose the real definition. After 3 rounds, the player with the most points wins!
Scoring
Each player who chooses the real definition gets 2 points.
Each player gets 1 point for every other player who chooses their fake definition.
Gameplay
BalderText supports 2-8 players.
- Every player texts ‘Join game’ to your game phone number, followed by a username, ie. "Join game <username>}. When all players have joined, one player kicks off the game by texting ‘Start game’ to the game number.
- All players receive the same word in a text, with a prompt to generate a fake definition for the word that other players will be likely to pick. The players are prompted to respond with their made-up definition.
- Once everyone has submitted their fake definition, all players receive every submitted definition as well as the real definition (in random order). Each player votes on which definition they think is the real one.
- After scoring, the round ends and the game sends a score summary to each player before starting the next round.
- After 3 rounds, the game ends and the player with the most points wins.
Commands
These are the commands you can text to your deployed BalderText number:
Command |
What does it do? |
Join game <username> |
Adds the message sender to the game with the provided username, or with their phone number if no username is provided. |
Start game |
Begins the first round of gameplay. No new players can join the game while it is active. |
End game |
Stops and removes the active game, if there is one. Players have to rejoin using the Join game command before starting a new game. |
<definition> |
Submits a definition for a player. Punctuation and capitalization is preserved in the player's response. |
<number> |
Logs the player's vote for the definition with the number submitted. |
What next?
Now that you’ve deployed your own version of BalderText -- you can bring it out at your next virtual gathering and get your friends and family in on the game. If you feel inspired to extend or update BalderText, or to build your own virtual happy hour survival game with Twilio, contribute to the GitHub repo, tell us about it here in the comments, or send me an email at eshenfield [at] twilio [dot] com. And check out the links below for more information about the tools I used to build BalderText. We can’t wait to see how you play!
Emily Shenfield is a Developer Educator at Twilio. She focuses on creating engaging demos of Twilio tools to inspire other developers to use Twilio in new and innovative ways. She is a homebody and is secretly really jazzed to be able to see all of her friends without leaving the comfort of her couch. You can reach her at eshenfield [at] twilio.com.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.