How I'm Sending Wordle Answers To My Phone Everyday
Tags: beginners, showdev
Published: 2022-02-24 04:47:58

I'm not a fan of [Wordle](https://www.tomsguide.com/news/what-is-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](https://github.com/rodiwa/daily-wordle)) 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](https://www.google.com/search?q=wordle+answers&ei=7AwXYrjIGMSJ4-EPlqWmuAw&ved=0ahUKEwi47sjHw5f2AhXExDgGHZaSCccQ4dUDCA4&uact=5&oq=wordle+answers&gs_lcp=Cgdnd3Mtd2l6EAMyCAgAELEDEJECMgoIABCxAxCDARBDMgQIABBDMgQIABADMgYIABAKEAMyCwgAEIAEELEDEIMBMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDoHCAAQRxCwAzoKCC4Q1AIQsAMQQ0oECEEYAEoECEYYAFDVEVjVEWC8E2gBcAF4AIABjgGIAY4BkgEDMC4xmAEAoAEByAEKwAEB&sclient=gws-wiz). This made it easier for me.
- I then [deployed this code](https://docs.aws.amazon.com/lambda/latest/dg/python-package.html) to an AWS Lambda, so I could run it periodically using a cron schedule.
- I [setup a schedule](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html) using a simple AWS CloudWatch Event rule.


![What notifications look like on the phone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7639vg9x75v9cdhy8mp9.jpg)

## 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](https://gamerjournalist.com/wordle-answers/), 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](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html) for third-party dependencies. I used [requests](https://pypi.org/project/requests/) and [beautifulsoup4](https://pypi.org/project/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](https://api.slack.com/messaging/webhooks) 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](https://dev.to/rizkyrajitha/get-notifications-with-telegram-bot-537l) 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.