I’ve been using Zapier intensively for a while now and I built some pretty advanced cool integrations with all sort of tools. Most of them were business related but I wanted to show you how we hacked some fun stuff for our own offices at Livestorm.
Here’s the basic story I was aiming for:
Every day at noon, I pick a random item in a pre-built restaurant DB. Then the Slack bot sends a new message in our #notifications channel containing the restaurant info.
Here are the main steps to build the Slack Bot:
- Scrap a viable source of restaurants
- Clean the data
- Start the Zapier integration
- Insert a small JS script to randomize
- Send the message in Slack
Find a reliable source of data
First things first, let’s find some data source worth scrapping. I figured that Yelp was our best choice but you might have some local platform in your area that’s more accurate.
I want restaurants with the following criterias:
- Delivery service (Not every restaurant in France offers that service…)
- Good restaurants
- Reasonably cheap
- Close to the office
- Open at noon
Go to Yelp and applied those criterias. Then copy paste the URL once the criterias are applied.
Crawl the source using Import.io & Store in Google Spreadsheet
I am not going to do a step by step tutorial on Import.io since it’s pretty straightfroward. Basically, pick the Crawler option and then go to your Yelp URL. Each data type will be a column in the final CSV generated.
Pick the data you need, here I selected:
- Phone number
That’s it! Then just run the crawler. Now import the whole thing to Google Spreadsheet:
Here I over used the
=REGEXEXTRACT() formula to clean it. Make sure you have the HTML of each item in a column in the list so that you can extract every element you want.
The Zapier integration
Almost there. First, since we want the script to run every day at noon, we’ll start with the Sheduling built-in app from Zapier:
Then we link our spreadshseet. We want to look up for that random value, we will be reusing the matching row’s data later:
Final touch, we create our Slack message:
And voilà. Here’s how it looks every day at noon:
To be 100% honest we stopped using it at Livestorm because the data we scraped was not as reliable as we thought. So try to get some real good up to date data.
Next step will be: cleaner data and a basic hosted randomization engine server-side.
Hope that helps.