如何响应电报僵尸Webhook请求? 相同的请求重复

我正在使用官方的电报bot api来制作一个使用nodejs的电报机器人(用于学习目的)。 我设置了一个webhook heroku。 我可以回复这个请求,但是经过一段时间之后,同样的请求会再次出现。 得到相同的请求是正常的,还是我没有回应接下来的请求。 当我调用getwebhookinfo方法时,它显示了pending_update_count,但是我的代码确实响应了来自webhook的所有请求。 我用这个来回复即将到来的请求

var express = require('express'); var bodyParser = require('body-parser'); var app = express(); var config = require('./lib/config'); var request = require('request'); var port = process.env.PORT || 3000; var reply_url = "https://api.telegram.org/bot"+config.bot_token; app.use(bodyParser.json()); app.get('/',function(req,res) { res.send("Working"); request({ url: "https://api.telegram.org/bot"+config.bot_token+'/getMe', json : true }, (err,res,body)=>{ console.log(body); }); }); app.post('/'+config.bot_token , (req,res)=>{ var body = req.body; console.log(body); console.log(body.message.entities); request.post((reply_url+'/sendMessage'),{form:{chat_id:body.message.chat.id,text:"POST REPLY SUCCESS",reply_to_message_id:body.message.message_id}}); }); app.listen(port, () => { console.log("Server is Started at - "+port); }); 

在res.status(201).send('Working')之后,尝试在API函数(req,res,next)的callback函数中添加next并调用next()函数。

类似的情况适用于其他POST API('/'+config.bot_token); 在/ sendMessage API的成功和错误callback中,调用res.status()。send()然后next();

总是调用next()作为使用express.js的标准做法