Open ohenrydev opened 2 years ago
The serverless function runs for 10 seconds and afterwards stops until it is invoked, This causes the webhook to work only once
@Jace254 - With a serverless function it won't be running all of the time and it should be started by an HTTP event being sent to it via the Telegram webhook. It may take more time for it to start up when it's considered "cold" (not been used for a while) but it should still respond. Have you got anything in the Vercel logs that show it being started?
@ohenrydevopr - I'm really sorry - I didn't spot your comment. Have you got it working now?
The same problem @MarcL, it works only once
Hey @opimand! 👋
That looks like an ngrok
URL - is this for local testing?
Are you hitting the /api/webhook
path too?
I'm using Insomnia to POST a request. Here's the message body I send to this URL https://your-ngrok-id.ngrok-free.app/api/webhook
:
{
"message": {
"chat": {
"id": "your-telegram-user-id"
},
"text": "Hello from Insomnia!"
}
}
Or try a CURL request:
curl -X POST -H "Content-Type: application/json" -d '{"message": {"chat": {"id": "your-telegram-user-id"}, "text": "Hello from curl!"}}' https://your-ngrok-id.ngrok-free.app/api/webhook
Let me know if you're still having problems.
I should add that I've redeployed to Vercel too and it responds multiple times for me. Let me know any more details and I'll help you to debug it.
I've done similar for Netlify too and I need to create a repo and blog post for that too.
Hi Marc, first of all I want to thank you for your repositories, they are helping me. My name is Henrique and I'm from Brazil and I'm having difficulties with the Telegram Bot using webhooks. I deployed it on Vercel, however, after setting the URL, it only works once.
I define the webhook, then use the getWebhookInfo endpoint and get the following return:
However, when performing a test (deleting the message sent to the Bot), it works, and then it doesn't work anymore. it works exactly 1 time. after that, when using getWebhookInfo again, I get the following return:
my url just disappears
I didn't find anything similar in the forums, neither from Vercel nor from telegram, I'm lost, do you have any insights on this subject?