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

312
Views
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
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!