How To Tweet From CLI On Windows 10 w. Node.js

Always working from PowerShell, CMD, Git Bash, or Git Shell? Ever want to tweet from the command line while your pushing code to your Github repository? I was interested in doing this on my laptop, making it easy to tweet on the go while I’m coding away at a coffee shop. I’d like keep my phone face down or in my pocket to avoid distractions… But that urge to tweet happens to often. Windows Store Twitter app is crap, and in browser is always sluggish… Let’s just tweet from the command line!

Tweet from CLI with Node.js

1.) Download & Install Node.js

2.) Run cmd.exe or PowerShell. I prefer to use Git Bash.

3.) Install cli-tweet by typing this command in:

npm install cli-tweet -g

4.) Now we need to see where npm installed the npm_modules folder.
npm root
It will return a path that we need.

5.) Open File Explorer, Right Click “This PC” -> Properties, click Advanced system settings, then click Environment Variables. Copy and paste the path that npm root gave you into your Windows 10 Systems PATH.

6.) Close your CLI window and run it again in Administrative Mode.

7.) Type the following:
tweet config

8.) It will give you an authorization URL that you have to copy and paste into your browser. Once the page loads, login and authorize RaedsLab app and it will give you a token to enter.

9.) With cli-tweet configured, try typing

echo "Hello Universe" | tweet

Do you like this awesome cli tweet tool? Go star the repo over on Github! If you don’t want to use RaedsLab Twitter app, you can create your own Twitter app and clone cli-tweet repository. In main.js line 13-14 you should see the key and secret for your Twitter App. You can install cli-tweet with your own key with the command: npm install /path

3 thoughts on “How To Tweet From CLI On Windows 10 w. Node.js

Leave a Reply

Your email address will not be published. Required fields are marked *