top of page

The Official Blog

of SX Bet

Building a Betting Bot: Module 1

Step 1: Install a Code Editor

A code editor is required to write, run, and debug your program. The recommended editor for this project is Visual Studio Code (VSC).

  1. Download Visual Studio Code from the official website:  https://code.visualstudio.com/

49-min.png

Step 2: Install Node.js

Node.js is a JavaScript runtime environment that allows the execution of JavaScript code outside of a browser.

1) Download Node.js from the official website: https://nodejs.org/en

2) Open the terminal in Visual Studio Code:

  • Windows/Linux: Ctrl + Shift + ~

  • Mac: Ctrl + Shift + ~

Paste the following command into your terminal and press enter: npm install axios

This command should return the installed Node.js version.

nodeversion (1).png

Step 3: Create a Project Folder

Create a project folder to organize the code files.

1) Create a new folder on your desktop (or preferred location) 

2) Open Visual Studio Code.

3) In the menu bar, select File > Open Folder.

4) Select the project folder

openprojectfolder.png

Step 4: Initialize the Project

Initializing the project sets up the necessary configuration files.

1) Open the terminal in Visual Studio Code;

  • Windows/Linux: Ctrl + Shift + ~

  • Mac: Ctrl + Shift + ~

2) Paste the following command into your terminal and press enter: npm init -y

This command generates a package.json file, which manages dependencies.

npminit.png

Step 5: Test Fetching Sports

This step verifies that the environment is correctly set up by fetching metadata from the SX Bet API.

1)  In Visual Studio Code, create a new file inside the project folder.

 

Click the New File icon. Name the file fetchMetadata.js.

createfile.png

2)  Copy and paste the following JavaScript code into fetchMetadata.js:

3)  Save the file. Windows/Linux: Ctrl + S  | Mac: Cmd + S

4) Install Required Dependencies:

 

For this test script, Axios is required to handle API requests. Paste the following command into your terminal and press enter: 

5. Run the script in the terminal:

 

Paste the following command into your terminal and press enter: 

The metadata from the SX Bet API should be now be displayed:

metadataresponse.png
3-min.png
3-min.png
50-min.png
51-min.png
52-min.png
53-min.png
54-min.png
bottom of page