Search

WhatsAWordel: Play Wordle right on WhatsApp!

Updated: Apr 13




Introduction


If you haven't been sleeping under a rock, you've come across the popular word guessing game Wordle and if you have(which includes me a few days ago 🥲), here's a quick gist:

Players need to guess a 5-letter word by making informative attempts. The game engine then returns how close your guess was to the actual word(I've explained an example below).


So a few days ago, I saw my family play this game and share their results on WhatsApp. Eventually, I saw many people including my friends playing the game on another app and sharing their results on WhatsApp. This gave me an idea: Could I build the Wordle game so that people could play it right on WhatsApp? And so that's what I did.


WhatsApp Api


Since the game was going to be a WhatsApp bot, I started searching how I could access a WhatsApp api. Turns out, WhatsApp is very specific in who gets access to their api and the application process requires you to be a registered company. And so I started finding a lawyer and a company name. (No I didn't lol)


After scouring through several websites and blogs, I came across Twilio - a company that provides a cloud communications platform as a service. I created an account and setup a basic sandbox environment to create the bot.





The way it works is that Twilio assigns one of their phone numbers to you and users can join your bot by sending this number a code(in my case "join tongue-around"). The next part was creating the logic of the bot.


The code for creating the logic was actually quite simple(I've attached the link) and I implemented it using a twilio function. The whole building process took only a few hours but I was able to learn a lot through it!


Testing


Here's a quick example of how the bot works. The secret word for today is "stone" so all responses are in relation to that.




Image 1: First, join the bot by sending "Join tongue-around" to the twilio phone number

+1 (415) 523-8886


Image 2: Then say hi. This will initiate a response with the rules of the game.


Image 3: This is the body of our game. We start by sending "noses". The bot's response tells us that 'n', 'o', 's' and 'e' are there in our word, but they're all at the wrong positions. Similarly the bot's response for "stain" tells us that 's' and 't' are at their correct positions while 'n' is there in our word but in the wrong position. The response for "shone" indicates that 's', 'o', 'n', and 'e' are at their right positions and 't' is not present in the word.


Image 4: The word "stone"returns a complete green string and therefore we have guessed today's word - Stone.


Video Demo





Going Forward


Creating WhatsAWordel was fun to say the least and my friends and family really loved the game! In fact within just 3 days, over a 100 users have started playing the game.


I think that WhatsApp games could be a big thing in the future where you don't need another app to play your favourite game! Just message a bot and start playing right on WhatsApp.


I already have a few ideas of which games to implement next - for example Akinator, 20 Questions or Hangman would all be interesting implementations. But until then, I hope you will try playing WhatsAWordel if you haven't already! And with that out of the way, thanks for reading my blog:)


Link to the code



Update 8th February:

My twilio credits to run the bot are over, and so the bot is now inactive. However, I would be happy to help you setup the bot, if you want to run it! Feel free to reach out.

87 views0 comments

Recent Posts

See All