Lunch Picker

Number of APIs: 4

An example Slack post

Lunch Picker is a Qodex collection that acts as a restaurant discovery service powered by the Yelp Fusion API. When run, the collection suggests places for you or a team to have lunch and posts the suggestions to Slack. It can be run locally with the Qodex collection runner or with Newman, or as a scheduled remote job with Qodex Monitors.

You can customize Lunch Picker's restaurant selection criteria such as location, distance, and price range with environment variables. The collection saves its choice history to a Qodex environment after each run to ensure future choices don't become repetitive.

Getting Started

Before you can run the Lunch Picker collection, you need to create or update an environment. Add the following required variables to a new environment, or update the Lunch Picker.template environment you downloaded with the Run in Qodex button:

Environment Variable NameRequired?Description
yelpClientIDYESA Yelp client ID.
yelpClientSecretYESA Yelp client secret.
locationYESSpecifies the combination of address, neighborhood, city, state or zip, and optional country to be used when searching for restaurants.
webhookYESA Slack incoming webhook url.
QodexApiKeyYESA Qodex Pro API key.
environmentIDYESThe id of your environment. Download your environment and copy the id, or get the id from the Qodex API.

Get a Yelp Client ID and Secret

You will need to Create a Yelp app to get the yelpClientID and yelpClientSecret values.

Enter a Location

Save the address of the location you want to search as location. The address should be in a region where Yelp is available, otherwise you won't get any results.

Get a Slack Webhook Url

Log in to your team Slack account and create a Slack app. Then activate and configure an incoming webhook for your app. Add this webhook url as webhook in your environment.

Get a Qodex Pro API Key

Log in to your online Qodex account and get an API key for the Qodex API, then add QodexApiKey to your environment.

Get Your Environment ID

Once you've created your environment, you can get the environmentID value by downloading the environment and copying the id from the environment file.

Try running the collection locally using the Qodex collection runner or Newman. It should get restaurant results for your location and post them to your Slack channel. If it doesn't, check the run results and the Qodex console to see what might have gone wrong.

A successful run

Going Further

You can customize the behavior of Lunch Picker with optional environment variables. Try updating the search radius or the price range to improve your results, or set favorite restaurants to increase the chance of those restaurants being picked. Once you have the settings you want, create a monitor to get periodic recommendations. Bon appétit!

  1. Pick Restaurants GET https://api.yelp.com/v3/businesses/search?categories=restaurants&limit=50&sort_by=best_match&offset={{offset}}&location={{location}}&price={{price}}&radius={{radius}}&open_at={{openAt}}

  2. Update Environment PUT https://api.getpostman.com/environments/{{environmentID}}

  3. Post to Slack POST {{webhook}}

  4. Get Yelp Access Token POST https://api.yelp.com/oauth2/token?grant_type=client_credentials&client_id={{yelpClientID}}&client_secret={{yelpClientSecret}}