3

I am developing a telegram chatbot using node-telegram-bot in Node.js that requires getting the previous messages or chat history of user and bot.

I tried using bot.getChat(chatId) method but it returns the following response

{
  id: ,
  first_name: 'R',
  last_name: 'S',
  type: 'private',
  has_private_forwards: true
}

index.js

const TelegramBot = require('node-telegram-bot-api');
require('dotenv').config();
const TOKEN = process.env.TOKEN;
const bot = new TelegramBot(TOKEN, { polling: true });

let chat = await bot.getChat(chatid)
console.log(chat)


I didn't find anything else that will help me retrieve the chat logs. I created a telegram application to use Telegram Core API but it is very complicated to understand to implement the bot using this.

Any advice or ideas to retrieve the chat logs?

Dummy Cron
  • 143
  • 2
  • 11

0 Answers0