Skip to content

Getting Started

Alkaar edited this page May 15, 2023 · 11 revisions

Table of Contents

  1. Downloading the Code
  2. Setting Up the Bot
    1. IDE
      1. Troubleshooting
    2. sbt
  3. Configuring the resyConfig.conf File
    1. Basic resyConfig.conf Setup
    2. Determining table-type
  4. Last Minute Flight Check
  5. Running the Bot
    1. IDE
    2. sbt

1. Downloading the Code 💻

There are two main ways to download the code, via the git command line or the GitHub website. This is already well documented on the web so I will simply point to those resources here.

Downloading the code via the GitHub website is the easiest way to do it. Using git command line is the preferred way but requires more steps and is for more advanced users.

2. Setting Up the Bot 🚧

There are two common ways to set up the bot. Using an IDE or Integrated Development Environment or using sbt. Setting up the IDE takes more effort but is easier to work with. sbt is faster to get it up and running but harder to work with. I would recommend setting up the IDE but if you are brand new to coding and you just want to get it up and running as quickly as possible, you may want to try the sbt route.

IDE

IntelliJ is a popular IDE for programmers. There are many flavors out there but we will use this one as an example on a Mac but you can also download it for Windows and Linux as well.

After you have downloaded and installed IntelliJ, you should open it and open up the parent path of where you downloaded the code.

IntelliJ Open Project

Optional: You may see the following prompt on your screen. Click Enable. This formats the code to be in a more readable format.

Scalafmt

On the top right-hand side, you should see the words sbt sideways. Click this. It will open up another window. Click the button farthest to the left with two arrows circling each other Reload. This will load your project and download all library dependencies.

You should be ready to go after completing the above steps.

Troubleshooting 🛠️

1. Cannot determine Java VM executable in current project's SDK

Your Java version is not set correctly. Go to File ➡️ Project Structure... and set the proper Java Version. The highest version you have should be sufficient. Java Version

2. Folder hierarchy incorrect on the left-hand side

Sometimes the project doesn't load up correctly and can look like the screenshot below.

Bad Folder Structure

Below is an example of how the folder hierarchy should look like. Note that the Scala folder is blue.

Correct Folder Structure

To fix this, go to File ➡️ Project Structure... and then select Modules. Depending on what you see on the right you may have to create or import a new module. Below is a screenshot of what you ultimately want to see.

Project Structure

sbt

sbt is a build tool for Scala. It allows you to work with your Scala project completely in the command line.

Navigate to the root directory of the code that you downloaded. Run sbt, then run compile. If was able to run successfully without error, then you're done!

3. Configuring the resyConfig.conf File 📝

The resyConfig.conf needs to be populated with the specifics of your account, restaurant, reservation preferences, and when for the bot to fire. Note, you will not need to share any personal information to use this bot! Some of this information you will provide yourself but some of this you will have to look up. You will need to use your browser's web console to visit Resy for the specific restaurant you want to snipe the reservation at. The web console will help you gather the information you need. Any browser will work, but we will use Chrome's web console in this example which is called DevTools. Below is a screenshot of what DevTools looks like.

Chrome DevTools

Basic resyConfig.conf setup

Open up your Chrome browser and press F12 which will open up DevTools. Ensure the Network tab is selected at the top. Visit the main Resy website for the restaurant you want to snipe the reservation at. You will notice that the DevTools window will start to fill up. In the top left-hand corner is a textbox that says Filter. Type the word find. Select any row, then select the Payload tab. Find the row that shows only a single venue_id number. There might be more than one row that has a single venue_id number. That's ok, just pick anyone. This row will have all the information you need. See the below screenshot for what it should look like.

find API call

Below are the specifics of where to find each piece of information for the resyConfig.conf file.

Field Tab Where
resyKeys.api-key Headers Below the Request Headers section, look for a request header called x-resy-auth-token.
resyKeys.auth-token Headers Below the Request Headers section, look for a request header called Authorization. You only need the characters after ResyAPI api_key=. Drop the double quotes.
resDetails.venue-id Payload Look for the numeric value right next to venue_id.

Determining table-type

Different restaurants have different table-types to pick from. Setting a table-type is optional but if you want more fine-grained control on selecting reservations, here's how you find what table-types are available to choose from. Again, we will use Chrome in this example.

Open up your Chrome browser and press F12 which will open up DevTools. Ensure the Network tab is selected at the top. Visit the main Resy website for the restaurant you want to snipe the reservation at. Select a date with the table type that you would like to snipe. You will notice that the DevTools window will start to fill up. In the top left-hand corner is a textbox that says Filter. Type the word find. Select any row, then select the Payload tab. Find the row that shows only a single venue_id number. There might be more than one row that has a single venue_id number. That's ok, just pick anyone. Now select the Response tab. Copy this entire text to your clipboard. Visit any JSON formatter website such as jsonformatter.io. Paste your clipboard and format the text. In the formatted text, search for a field with the word "token". In the same vicinity of this field you should also see another field called "type". This is the table-type that you can set in the resDetails.res-time-types field in your resyConfig.conf file. Below is an example of what this looks like.

table-type example

4. Last Minute Flight Check ✈️

Be sure you have a credit card associated with your Resy account and that the credit card is not expired or else the bot won't work!

5. Running the Bot 🏎️

Depending on which way you set up the bot, you can either run it inside of your IDE or via sbt.

IDE

Again we will use IntelliJ here since it is a popular IDE for programmers. On the top right-hand side of the screen there should be a green arrow facing right IntelliJ Run. Click this, and it will run the bot.

Sometimes, IntelliJ isn't able to auto-create the run config properly. In which case you may have to create it manually. See screenshot below for how it should look like.

IntelliJ Run Config

sbt

Type sbt to start the sbt instance, then type run. It will have some output then bring you back to the sbt prompt. Do not exit out of the sbt prompt as this will kill the bot. The bot is running inside the sbt instance and will wake up at the appropriate time to snipe a reservation.