Since the lockdown it has been difficult to get a delivery slot from a supermarket. Some grocery stores have implemented a queuing system to access the site (Ocado) or even stopped letting new users register (Sainsbury).
After another unsuccessful day of refreshing, I thought there must be an easier way. Therefore, with all this extra time at home, I decided to build a bot to alert me to available groceries slots. To my surprise, it really wasn’t too difficult at all.
Looking at requests
Depending on the site, you can see what sort of requests are made when viewing the delivery booking page by using Chrome inspector and looking in the network tab. From there it’s a just a matter of saving the cookies and automating the requests.
When the cookies expired the request would be denied. So, I added a headless browser function to login and save the cookies automatically for next time.
Hosting
I built the bot to be hosted with AWS Lambda functions, so I didn't need to leave my computer on all night or have an instance running 24/7. This was very easy to set up and deploy using Serverless.
Captcha
Unsurprisingly, the captcha code would come up for some sites when the bot was trying to log in. There wasn’t much I could do about this, so I just skipped the stores that had this implemented (Ocado and Morrisons).
Alerts
I got my bot working with Asda and Tesco, and it would check every 10 minutes for any available slots. I found this interval to be enough, because unlike concert tickets, delivery slots don’t sell out as soon as they became available, plus I didn’t want to spam the site with traffic.
Conclusion
This was fun to build, but by no means necessary. There are now quite a few local and smaller grocery stores providing delivery service. I would encourage you to check those out if you can.
If you still want to use one of the main supermarkets, try a bit later at night or in the morning. Friday and Saturday almost always have no slots available, but some free slots start showing up on Sunday afternoon.
Disclaimer: I only booked one slot per week to ensure I wasn’t taking up slots unnecessarily.
Top comments (0)