I'm not a fan of Wordle. What I AM a fan of, is bumming out my loved ones by getting the right Wordles without having to stress about it. Call it a cheat-code.
What I Wanted To Do
- I wanted to get the daily Wordle, right into my phone. Everyday.
- All this without having to guess the word, even though my English is very the amazghingly.
How I Did It
- I created a Slack channel and a Telegram group. This is where I'd be sending the Wordles everyday.
- I setup a simple python code (It's on my GitHub) to scrape websites that give you Wordles for the day. It would then send that Wordle to Slack, Telegrams above. I was surprised to see so many websites giving away the answers. This made it easier for me.
- I then deployed this code to an AWS Lambda, so I could run it periodically using a cron schedule.
- I setup a schedule using a simple AWS CloudWatch Event rule.
Some Considerations
- Most of the websites I found had a date and/or some counter in their URL. This would mean I would have to dynamically update the daily URL in code everyday. The trick was to find a website that has a static URL, so you can hardcode it once and forget about it.
- If you're using AWS Lambda, it goes without saying you'll have to deal with AWS Lambda Layers for third-party dependencies. I used requests and beautifulsoup4.
- Picking the "scheduled" time to run was a little tricky. Turns out a new Wordle comes out at midnight GMT (5:30AM IST, my time). And the websites I want to scrape comes out with their answer a little over 11:30AM IST. So I figured having a run time of 2PM should not be too bad. I also scheduled another run at 7PM, just in case the website had not been updated by then. It also acts as a reminder if I myself missed to see the first notification.
- AWS Lambda sets the time in GMT, so I had to convert that to IST. I used the very famous https://crontab.guru/ to config my cron.
- I initially setup on Slack at first, but then to add members, they would have to be on Slack themselves. WhatsApp API does not allow to send messages to groups (I think you need a business account for that). I decided to eventually send message to a Telegram group as it has easy API integrations and most of my friends are on Telegram anyways.
- I decided against a Telegram channel, and to have it on a group only, just so I keep this side-project private to me and my friends.
Top comments (0)