@ethos_network
👇👇👇
1. Introducing the Ethos Network Telegram Bot!
Hey everyone! I’m
@sefiyed, and today I want to share an exciting project: a Telegram bot that checks Ethos Network profiles. Ethos is a decentralized reputation platform in the Web3 space. This bot lets you view detailed info like scores, reviews, vouches, and more by entering an Ethereum wallet address.
I wrote the code myself, and it’s open-source. Let’s break it down step by step!
#EthosNetwork #Web3 #TelegramBot
2.First, what is Ethos Network?
Ethos is a decentralized network where users can build and manage their reputation in the crypto ecosystem. Through reviews, vouches, and slashes, it acts like a LinkedIn for Web3. This bot pulls profile data from the Ethos API and displays it beautifully.
If you have an Ethereum wallet, you can check your profile!
3. Now, onto the code. This bot is built with Node.js, using node-telegram-bot-api and node-fetch libraries. It starts by loading dotenv to get the bot token from a .env file (for security).
Code:
require('dotenv').config();
const TelegramBot = require('node-telegram-bot-api');
const fetch = require('node-fetch');
Store your token in .env: BOT_TOKEN=your_token_here.
#NodeJS #Coding
4. Setting up the bot:
const token =
process.env.BOT_TOKEN;
const bot = new TelegramBot(token, { polling: true });
It uses polling to check for messages (instead of webhooks). There’s also a userStates object to manage user states (like waiting for a wallet
5.The main function: fetchEthosProfile
This function takes a wallet address and fetches data from the Ethos API. It first hits the activities API:
const url = \
api.ethos.network/api/v1/act…:${address}\`;`
With specific headers (like X-Ethos-Client: ‘web’) to mimic the Ethos web app. If successful, it grabs the profileId and calls a second API for stats.
Handles errors gracefully.
#API #Fetch
6.The formatEthosData function:
This formats the data nicely. For example:
🎯 *Ethos Network Profile*
👤 *Name:* ${
profile.name || 'Not set'}
It displays review stats, vouches, and slashes with emojis. Uses Telegram Markdown for bold, organized text. If there’s an avatar, it sends a photo!
#UI
#Formatting
7./start: Sends a welcome message and shows the menu.
bot.onText(/\/start/, (msg) => { ... });
Buttons like 🔍 Get Ethos Profile” are included. When clicked, it sets the user state to ‘waiting_for_address’ and prompts for an address.
Also has help, support, and cancel options.
#BotCommands
8. In on(‘message’) it checks if the user is waiting for an address, validates it with regex (/^0x[a-fA-F0-9]{40}$/). If valid, fetches data, shows a loading message, and sends the results. Handles errors with a friendly message.
Then returns to the main menu. Very user-friendly!
#Validation #ErrorHandling
9. Security: Token hidden in .env.
Efficiency: Uses async/await for fetches.
Scalability: Easy to add features like multi-address search.
To run: npm install node-telegram-bot-api node-fetch dotenv, then node bot.js.
If you’re a developer, fork and improve it! Full code on my GitHub (add link if available).
#OpenSource
#DevTips
10.This bot is a simple yet powerful tool for the Web3 community. If you use Ethos, give it a try! Search for the bot on Telegram (add bot name if available) or run the code yourself.
Questions? Comment or DM
@sefiyed . Don’t forget to like and RT! 😊
#EthosBot #Web3Tools
Access and sharing:
t.me/Ehtosrankbot
github.com/kamiwho/ethos-ran…
app.ethos.network/profile/x/…