Whenever you have a mundane task that you do almost every day, it might be a good idea to automate it. For this reason our team in Kraków, after checking the online lunch menu of our favorite nearby restaurant over and over again, decided it’s time to introduce a solution to this problem (as first world as they get).
The task was pretty simple. Every day a new menu gets published on the restaurant’s website. We wrote a python script that downloaded HTML content, extracted menu text with simple regular expressions and sent a notification to one of our Slack channels – and this worked great.
But then, one day, the HTML changed dramatically. The restaurant’s website looked almost exactly the same, but all our regex matching code was broken. Fixing this would probably take only a couple of minutes, but we decided to make it a bit more interesting…
At Filestack, we have a wide range of powerful and user-friendly tools, so why not put them to good use? Instead of updating our regular expressions and waiting for the HTML to change again, we used something more robust and easier to maintain – a Filestack Workflow.
Configuring it in our Developer Portal took less than two minutes. Now, every weekday a cron job stores a screenshot of the restaurant’s website and provides our workflow ID. This triggers all the tasks we have defined – cropping the image, resizing it and then extracting text using OCR. We just need to wait for a webhook with the result. When it arrives, a couple of emojis are added to the extracted text and a Slack notification is sent. Job done!
What our workflow actually does
Does it seem over-engineered? Yes (did I mention we also have logging/monitoring in place?). Could it be done in a simpler way? Sure. Would it still be this much fun? Definitely not! Either way, automation solves a host of problems, large or small.
To learn more about all that Filestack Workflows can do, reach out to us:Contact Sales
Read More →