NodeJS Steemit Bot Tutorial

This tutorial will get you started with building bots for Steemit using JavaScript/Node.JS/NPM/GitHub/Command Prompt/Sublime in Windows 10. The user should be a novice or intermediate web/software developer. It does not require any prior knowledge working with JavaScript/Node.JS/GitHub or Steem. However, you will need to create GitHub and Steemit accounts. This tutorial will be exhaustive covering in detail each step along the way. If you already have Node.JS and GitHub installed on your Windows 10 machine, then you may want to skip Step 1 and 2. You may want to start with my easier introduction at https://steemit.com/steemit/@money-dreamer/creating-first-steemit-bot if this exceeds your abilities.

##Step 1: Install & Set-up GitHub

Download the GitHub software for Windows by visiting https://desktop.github.com/ and clicking “Download for Windows”. Most PC's are 64bit these days.

Launch the MSI installer from the bottom of the browser after it finishes downloading. You will see this window while it is being installed:

If you do not already have a GitHub account, now is the time to create one. GitHub has a very elegant and pleasant GUI.

Otherwise, continue with signing in to your GitHub account:

Enter your GitHub username and password:

Enter in your 2FA (2-Factor Authentication) here:

You will now need to clone the demo repository from https://github.com/AdamCox9/Steemit-NodeJS-Bot-Tutorial by clicking the “Clone a repository” button from within the desktop app:

Select “Clone a Repository”, then select the “URL” tab. Next, visit the URL https://github.com/AdamCox9/Steemit-NodeJS-Bot-Tutorial.git and click the Fork button. This will create a forked version of the demo so you can start making your own customization:

Once you fork the repository to your own GitHub account, copy the URL from the GitHub web page by clicking the green “Clone or download” button. Make sure your username is showing instead of 'AdamCox9' and click the copy button on the right of the URL:

Paste that URL into the field and click the big blue “Clone” button. You can change the Local Path if you desire but it is not required. Take a note of it so you don't lose it later on.

FYI, GitHub will be installed to C:\Users\8d8ap\AppData\Local\GitHubDesktop replacing 8d8ap with your Windows username.

##Step 2: Install & Set-up Node.JS/NPM (Node Package Manager)

Download the stable version of Node.JS installer from: https://nodejs.org/en/ As of writing this article it is version 8.9.3 LTS:

Click the MSI installer from the bottom of your browser after it downloads. Click Next to follow the Node.JS Setup Wizard.

Agree to the terms and click Next:

Install NodeJS to the default Destination Folder:

Leave all values at their default by clicking Next:

Finally, click the Install button:

Wait for the setup to finish:

NodeJS installation should complete:

To test that it has been installed search for cmd in the Start Menu to open the Command Prompt. Type the Node command with -v option to get the version node -v. It should look like:

Change directory in the Command Prompt to the GitHub folder containing the Steemit-NodeJS-Bot-Tutorial repository with the cd (change directory) command:

Let's get the latest steem package from NPM (details: https://www.npmjs.com/package/steem ) by typing the command npm install steem --save It might look something like. Ignore the warnings.

Now that you have the GitHub repository cloned and NodeJS setup on your computer, lets get started with building the bot.

##Step 5: Install Sublime Text Editor. This is only recommended since you can use any browser that you choose. It can be downloaded from https://www.sublimetext.com/


Open the EXE file and follow the steps presented:

Install to default location:

Check the “Add to explorer context menu” so that you can right click a file and open it with Sublime directly:

Click the Install button:

Click “Finish” to exit the Setup Wizard:

Here is a sample program that casts a vote for my prior post “Creating First Steemit Bot” https://steemit.com/steemit/@money-dreamer/creating-first-steemit-bot

var steem = require('steem');
var username = 'ENTER_USERNAME_HERE';
var password = 'ENTER_PASSWORD_HERE'; 

var wif = steem.auth.toWif(username, password, 'posting');
steem.broadcast.vote(wif, username, 'money-dreamer', 'creating-first-steemit-bot', 10000, function(err, result) {
    console.log(err, result);
});

Open the directory containing the Steemit-NodeJS-Bot-Tutorial folder containing the 'start.js' file. Use Sublime Text Editor to edit the 'start.js' file by right clicking it and selecting 'Open with Sublime Text':

Add your username and password where it says 'ENTER_USERNAME_HERE' and 'ENTER_PASSWORD_HERE', respectively:

Do not share your password with anybody and do not commit it to GitHub as that will publish it. You can verify that your vote went through by visiting https://steemd.com/@money-dreamer Your response should look like the following image:

Step 6: Upvote, Resteem, Follow and Wait For My Next Tutorial

Feel free to ask any questions or give any advice in the comment section below!

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center