Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

314
Visualizações
Sending Live Location to TelegramBot via Nodejs

How can I get users' live location when they share it with a Telegram Bot?

I am using node-telegram-bot-api in this project. I have managed to get the bot request one-time location from the users. Here's the code:

import TelegramBot from 'node-telegram-bot-api';    
const token = 'XXXXXXXXXXXXXXXXXXX'

// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {polling: true});

bot.onText(/start/, (msg) => {
  const opts = {
    reply_markup: JSON.stringify({
      keyboard: [
        [{text: 'Location Request', request_location: true}],
      ],
      resize_keyboard: true,
      one_time_keyboard: true,
    }),
  };
  bot.sendMessage(msg.chat.id, 'some message goes here', opts);
});

bot.on('location', (msg) => {
  //console.log(msg.location.latitude);
  //console.log(msg.location.longitude);
  //do something with the lat long
)};

But I need the bot to capture live location from the users. There is a small reference to this question in StackOverflow here but that answer is for the bot sending its live location to the user. I need it to be the other way around.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda