Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

333
Views
Using a Telegram Bot, can a user trigger another user session of the bot?

I have a big problem. I'm looking like a day to find a solution.

I created a Telegram Bot with the user sessions.

I need a user from his session to be able to update another user's session.

I have already tried to use a sendMessage from the session of the first user which goes to send a message to the session of the second user. But I can't handle this message because, as I've seen, the bot.on() method only handle the message from the user, not from himself.

Any idea?

UPDATE 1: Ok I think I have to give you more information.

There are 2 users. The 2nd user has a button. With the click of this button I want to run some logic on the session of the first user. At the moment with the click of the button I'm sending a msg in the session of the first user, but I can't trigger any logic.

Here the method inside the command triggered by clicking the button of the 2nd user:

bot.command('leave', async (ctx: MyContext)=>{
  try{
    await ServiceHelper.updateSession(ctx.session.chatId!, "");
    await ctx.api.sendMessage(ctx.session.chatId!, "The user left the conversation 🧐", {reply_markup:{resize_keyboard: true, one_time_keyboard: true, keyboard: MenuChat.chatLeftMenu.build()} });
    ctx.session={
      ...ctx.session,
      chatId: "",
      step: "startMenu"
    }
    await MsgHandlerStart.managerStart(ctx);
  }
  catch(error){
    await ctx.answerCallbackQuery({text: ctx.i18n.t("answer-callback.wrong-command")});      
  }
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!