COSS Telegram Trade Notification Bot Installation Guide

0
195

Installation Guide for Windows

Download Source Files from GitHub

To begin, you will need to download the source files from GitHub. Click the button below to download the file directly, or get the files yourself from GitHub here.

Install Node.js

You may already have Node.js installed, if so you can skip this step. If not, download the latest version of Node from their website.

The installation process should be easy enough to follow along with, just install with all the default settings.

Extract and Install the Coss-Telegram-Notifier

Right click the zipped file you downloaded from GitHub and select ‘Extract All…’ to unzip the files.

You will need to copy the location of where you downloaded these files.

First navigate to the folder that contains the file ‘index.js’.

Then, an easy way to copy the address is to click the address bar (highlighted above in yellow) and press ‘CTRL-C’ to copy the address to your clipboard.

Now to install the files, open Windows Powershell as an administrator. To do this, seach powershell in your search bar and right click the top result.

Choose ‘Run as administrator’ and a blue window will pop up.

Now we need to direct the command prompt to the address where you unzipped your files. Type ‘cd’ in to the command prompt and then press ‘CTRL-V’ to paste in the location of your files – an example of what you should type is below. Press enter to confirm the command.

cd C:\Users\Youruser\Downloads\coss-telegram-notifier-master\coss-telegram-notifier-master

This will change the directory you are working in. Now you are in the right location, you can begin the install. Type ‘npm install’ to begin the installation.

PS C:\Users\Youruser\Downloads\coss-telegram-notifier-master\coss-telegram-notifier-master> npm install

The process may take a couple of minutes – you should see this when the installation is complete:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN coss-telegram-notifier@1.0.0 No repository field.
npm WARN coss-telegram-notifier@1.0.0 No license field.
added 152 packages in 29.339s

Create Your Own Telegram Bot

Chatting with the BotFather

The next step is to create your Telegram bot – click here to create one with ‘BotFather’ for free.

BotFather will reply and help you create a new bot. Simply type /newbot in the chat message to BotFather to get started.

BotFather will then ask you to name your bot – it must end with the word Bot.

It will then give you an HTTP API Access key like this – 716110382:AAAAAAAAAA-BE50aAAAAAAN4vtC_r_ReoAAA – copy and keep this safe as you will need it in a minute.

Create an API Token on COSS

First log in to COSS.io and then head to the ‘API management’ page under ‘Services’.

Type a name for your API key (it can be anything) in the ‘Name of Key’ box and click ‘Create New Key’ – you will need to enter your 2FA and confirm via email. Once you receive the confirmation email, you will be redirected to a screen like above. This will show you your public key and secret key.

These will only be shown once, so copy them down and do not navigate away from this page until you are ready!

You can disable this API key from creating orders for extra peace of mind when using it with this bot.

Edit Coss-Telegram-Notifier Index.js

Navigate to the index.js file in the folder that you downloaded from GitHub and open with a text editor such as Notepad++ – do not use Word.

There are 4 lines of code that you will need to edit, they are well documented in the file, but use the search function in your text editor if you cannot find them.

The first 3 lines to replace are in bold below.

// replace the value below with the Telegram token you receive from @BotFather
const token = 'your-token-here';

// COSS API KEYS
const PUBLIC_KEY = 'your-coss-api-public-key-here';
const PRIVATE_KEY = 'your-coss-api-secret-key-here';

Now you will need to start your bot. Go back to the PowerShell window and type:

node index.js

You should get the following message:

PS C:\Users\Youruser\Downloads\coss-telegram-notifier-master\coss-telegram-notifier-master> node index.js
node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. module.js:652:30
(node:15768) ExperimentalWarning: The http2 module is an experimental API.

You can now chat with your bot on Telegram! Message your bot on telegram and type /start in the chat. It will give you a chat ID e.g. 55437555. If you can’t find your bot on telegram, type /mybots in the chat with BotFather and it will send you a clickable link.

You now need to go back and edit your index.js file. First stop the bot running by pressing ‘CTRL-C’ in the PowerShell window, or by simply closing the PS window. In index.js change the line that asks for your chat ID and save the file

// Start bot and use /start to get your chat id
const CHAT_ID = your-chat-id-here;

Load Up the Telegram Notification Bot

Chatting with a self hosted notifier bot

In the PowerShell window (if you closed it previously, make sure you are in the right directory using the cd command from earlier), type node index.js to start the bot running again.

Now, you can chat with your bot and get it to start tracking your orders – alerting you to when your orders get filled. Perfect for trading promotions!

  • /list – Will list pairs currently being watched
  • /add – Add a new pair to watch e.g. ‘COSS-ETH’
  • /remove – Remove a pair from watch list
  • /watch – Records current open trades and alerts you when they are filled
  • /stop – Stops the bot watching for trades

Further Tweaking the Bot

If you were confident in the editor, adding the keys, there are some further settings you could tweak, such as the refresh rate and the default pairs the bot has already on it’s list on startup (the pairs added through the chat interface are reset every time the bot is reset turned off).

If you have any issues, feel free to leave a comment and I can try and help.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.