Cizaquita Cizaquita - 5 months ago 148
Javascript Question

Telegram bot api - QUERY_ID_INVALID in answerInlineQuery - Javascript

I'm trying to use answerInlineQuery method but i have an error:

function(inlineQuery) {
var url = API_URL + '/answerInlineQuery',
params = {};
var inline_query_id =;
var results = [{

params.inline_query_id = inline_query_id;
params.results = results;

request('post', url, JSON.stringify(params), function(data) {
if(data && data.ok){
console.log('answerInlineQuery enviado');
console.log('Error enviando answerInlineQuery: ' + JSON.stringify(data));

The parameters that i'm sending are (formated with

"inline_query_id": "32021086267134929",
"results": [
"type": "location",
"id": "1",
"latitude": 4.710989,
"longitude": -74.072092,
"title": "Bogotá"

I'm using Javascript with a
request function to the Telegram Bot API and the error that i have is this:

Error enviando answerInlineQuery: {"ok":false,"error_code":400,"description":"[Error : 400 : Bad Request: QUERY_ID_INVALID]"}

I just saw this question: telegram bot api python error but i don't know how json.dumps works in python. I need to know the correct "params" format that i need to send to the API.


I had 2 problems, no stringfy the "results" and stringfy the "params" that was wrong.

I just needed stringfy the "results" and not stringfy the "params"