This project is a Node.js application designed to monitor events on the Energy Web Chain, specifically focusing on a smart contract that handles token lifting operations. It sends notifications via Twitter and Telegram whenever a significant event, such as a token lift, occurs on the monitored smart contract.
Clone the repository and install the dependencies:
git clone https://github.com/mhrsntrk/ewx-bot.git
cd ewx-bot
npm install
To send messages via Telegram, you need to set up a Telegram bot:
- Open Telegram and search for "BotFather".
- Start a chat and use the
/newbot
command to create a new bot. - Follow the instructions to name your bot and get a token.
- Add the bot to a group or send a direct message to it.
- Retrieve your chat ID by visiting
https://api.telegram.org/bot<YourBotToken>/getUpdates
.
To set up the Twitter API v2, follow these steps:
- Go to the Twitter Developer Portal and create a new project/app.
- Navigate to the "Keys and tokens" section and generate your "API Key" and "API Secret Key".
- Set the required permissions for your app and generate "Access Token" and "Access Token Secret".
- Add the following environment variables to the
.env
file.
Create a .env
file (based on the .env.example
) in the root directory of your project and update it with your specific details.
To run the project locally, use:
node --env-file=.env index.js
To deploy the app using Caprover into any VM, follow these steps:
- Ensure you have CapRover CLI installed.
npm install -g caprover
- Log in to your CapRover server
caprover login
- Check
captain-definition
andDockerfile
in the repo, modify if necessary. - Deploy your app using the CapRover CLI
caprover deploy
- Configure the app details (env, https, container port, etc.) on the Caprover dashboard.
mhrsntrk (@mhrsntrk)