🚀 Merge services for user
When specific user decided connection to specific sniper-bot, our service must provide mechanism to secure linking user to sniper-bot, so each sniper bot must add one condition (when user sending messages), bellow we provide example on most popular Node.js librarynode-telegram-bot-api , how to do that:
const TelegramBot = require('node-telegram-bot-api');
const TRIGGER_KEY = 'LOTUSMARKET';
// API-KEYS
const TELEGRAM_TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN';
const LOTUSMARKET_API_KEY = 'YOUR_LOTUS_MARKET_API_KEY';
(() => {
const bot = new TelegramBot(TELEGRAM_TOKEN, {
polling: true,
});
bot.on('message', async (data) => {
const {
text,
chat: { id },
} = data;
if (text.startsWith(TRIGGER_KEY)) {
const response = await fetch('https://lotusmarket.io/api/v1/sniper-bots/verify', {
method: 'POST',
headers: {
‘Accept’: ‘application/json’,
'Content-Type': 'application/json',
'Api-Key': LOTUSMARKET_API_KEY,
},
body: JSON.stringify({
verificationCode: text,
id,
}),
});
if (response.status === 200) {
// NOTIFY USER THAT EVERYTHING IS OKAY
bot.sendMessage(id, 'You was connected to LotusMarket terminal!');
return;
}
// NOTIFY USER THAT EVERYTHING IS OKAY
bot.sendMessage(id, "Now you can't connect to LotusMarket terminal!");
}
});
})();
Here, as you can see, there is also a part where the sniper-bot will need to send an additional request when reading this type of message, below is the detailed instruction how to use route that is shown in the example above.
https://lotusmarket.io/api/v1/sniper-bots/verify
BE CAREFUL! YOUR ACCESS MAY BE RESTRICTED FOR THE FOLLOWING REASONS:
- YOUR IP-ADDRESS WAS CHANGED, AND NOW API FOR YOU IT'S NOT AVAILABLE, PLEASE NOTIFY US
- YOU USED TO MANY ATTEMPTS OF REQUESTS, OUR LIMITATION IS 60 REQUEST PER MINUTE
- SOMETIMES WE NEED TO REFRESH OUR WHITE LISTS AND IN THIS MOMENT SERVER CAN BE NOT AVAILABLE
Accept: application/json
Content-Type: application/json
Api-Key: <YOUR_API_KEY>
{
"id": 0,
"verificationCode": "VERIFICATION_CODE",
}
id
NUMBER
Telegram chat id of user that written verification code
verificationCode
STRING
Code that user copy from the terminal for connection to sniper-bot
If request passed by all conditions successfully, the response will be in the next format
{
"status": 200,
"message": "User was successfully verified!"
}
If request was failed, the code and the reason will be provided in the response
{
"status": 404,
"message": "Verification code not found!"
}
If API-KEY is invalid, the response will be in the next format
{
"status": 403,
"message": "Unauthorized"
}
If user was already activate by given verification code, the response will be in the next format
{
"status": 400,
"message": "User has already been activated"
}
When user used to many attempts, the response will be in the next format
{
"status": 429,
"message": "No more than 60 requests per minute"
}
No more than 60 requests per minute
NUMBER
Error code in the inner API
message
NUMBER/p>
Described reason, why request if failed