Cannot set the webhook of my Telegram Bot - bots

I set the webhook of my Telegram Bot and it seems to work fine, but the bot doesn't reply when I try to write him. The code of the file I indicated as webhook is correct (I checked it with getupdates method) and the server where it's hosted has the SSL certificate.
Trying to see the result of the method getWebhookInfo I checked up that the error was "Wrong response from the webhook: 410 Gone".
Anyone could help me to find out where the problem is?

I recommend you to copy the url you received from getWebhookInfo and then POST some valid JSON to it (e.g. on linux with curl, examples here: Telegram Guide).
WRON RESPONSE FROM WEBHOOK indicates that there is a problem with your web server configuration or something elso on the way in.
"410 Gone" is returned by your webserver, so maybe your .httaccess config is wrong (if using Apachee).

Related

How to send card response for outgoing webhook in microsoft teams

This doc said I could use card/image/mention response using outgoing webhook but there is no example other than simple reply.
I also tried json response
But my bot says
Sorry, there was a problem encountered with your request
This works!
Any other examples...?

Zapier Webhook issue

I've set up a ZAP so that when a subscriber is added to my aweber email list they are automatically added to a product in my membership plugin called DAP or digital access pass.
As per the instructions of the membership plugins developers, I am using a webhook in the zapier 'post' section.
It's not working. Quite simply the webhook doesn't appear to be calling anything.
Now, weird thing is that zapier logs show the webhook has been sent and has had success. But from DAP's end nothing is being received.
The support team at DAP tell me that the script isn't being called, because nothing appears in their logs.
They show me this by putting the webhook URL into a browser and calling it that way, and THEN the relevant info arrives in the DAP logs.
Zapier told me they do not trouble shoot and so advised that I post here.
Would appreciate any help. Thank you very much.
Dan
You can easily test if Zapier is making a call or not by sending the request to http://requestb.in
Steps:
Create a request bin and copy the URL.
Request bin screenshot
In Zapier, replace the webhooks post URL with the requestb.in URL.
Now, whenever the Webhook makes a post request, you should be able to visit the inspect page of your bin and check if a request was received. Just add ?inspect to the end of the URL. For example, if your Request bin URL is https://requestb.in/wbto8jwb then you should visit https://requestb.in/wbto8jwb?inspect
The inspect page will show all the requests received.
With this, you will know if Zapier is sending the requests. If the requests are being received by request bin then there is something which needs to be fixed by DAP.
Note that it could also be something in the configuration of the Webhook that is causing the request to not be recognised by DAP. It will help if you add more details to your question - what format is the DAP team expecting to receive the data in?
Below is a sample Webhook implementation in Zapier.
I have added a hook to POST data to a request bin (https://requestb.in/wbto8jwb)
Webhook POST screenshot
When I test this step, the request is received in the Request Bin Inspect page (https://requestb.in/wbto8jwb?inspect).
Request Bin Screenshot
More reading:
https://zapier.com/help/webhooks/
Update:
You can also make a direct call to the DAP API by using a tool like https://www.hurl.it/. From the drop down in destination, select POST and put the URL here. Click on Add body and paste the raw data from request bin. Now ask the DAP team to check if the request was received.

I set my telegram bot webhook, but do not send the telegram. Why?

I set webhook my telegram bot with setwebhook method but when I send a message in bot don't take this in my URL.
https://api.telegram.org/bot<token>/setwebhook?url=https://www.example.com/bot/temp.php
In my host I use PHP language for take and analysis and answer that. and I user this command for get updates from bot.
$update = file_get_contents(“php://input”);
But after run this line $update is empty.
I haven't problem with take updates without setwebhook bot when I use webhook don't take data.
result run getWebhookinfo is:
{"ok":true,"result":{"url":"https://example.com/bot/temp.php","has_custom_certificate":false,"pending_update_count":0,"max_connections":40}}
Do I have to be true "has_custom_cere"?
Thanks for help me
Mohammad, I think a PHP error occurred when telegram sends the request to you. Following code should works fine for getting the Telegram request.
$json = file_get_contents('php://input');
$request = json_decode($json);
I think your script stop before this code. I suggest you to enable PHP debug mode and check the error log.
You can find out problem via following method:
Check getWebhookInfo method, make sure your webhook URL is correct, and no last_error_message field.
POST similar data to your server, here is some data you can use in curl -d JSON, just copy it and run on your own server.
At last, check your CDN config (if you had applied on that server), temporary disable flooding or any check.
What is the outcome of the /getwebhookinfo method and could you post it here?
Please check if you SSL certificate valid (happend once to me) and what shows if you call the website in your browser (any php errors?).
I would have commented that, but I don´t have enough rep... Sorry :/
Please follow this way and if you don't get answer, your PHP has problem :
1- Revoke your Auth Key from BotFather by typing /revoke
2- Reset your Webbhook by new Auth Key :
https://api.telegram.org/bot<token>/setWebhook?url=https://www.website.com/bot_path
Notice #1 : setWebhook is case sensitive and W keyword must be capital.
Notice #2 : If you're using CMS such as Codeigniter, Laravel, Zend etc. It doesn't need to put .php after your bot_path and if not use it.
Notice #3 : If you want to delete last Webhook that you have set, You just need to write above url without ?url= at the rest.
3- After all you receive this message from telegram :
{"ok":true,"result":true,"description":"Webhook was set"}
Now you can test your Bot, But be aware that do this way to check your Auth Key and If there is no problem, absolutely your PHP code has problem. If you have problem yet please contact me on website to solve it Graphap and then put the right answer here.
I've told to recheck this way because I had problem frequently because of Auth Key which not working But now it works as well.

Empty message body in receive messages from telegram bot

We are using telegram bot webhook method and our website ssl is CloudFlare free ssl, telegram bot works and telegram call our csharp api, but text of messages that telegram send to our api is empty.
Anybody could guide me about this issue.
Had the same problem in php project. In the documentation, they write that request will be via HTTPS POST. But I received empty data. Solution: use file_get_contents(php://input) instead trying to get data from $_POST

Telegram Bot webhook really slow

I've created a telegram bot and set a webhook as described in the docs. For testing purposes I've set it up so once you send the bot a message it replies back with the same message.
Now the issue I am having is that the updates from telegram are coming back really slowly and there are some messages I haven't received yet. Am I missing something or is the webhook method just really slow?
I had the same problem. Turns out I wasn't responding the telegram server after I got the POST request. Due to this, the server wasn't sure if I got the previous updates and was constantly sending my webhook past updates.
I have an express server and I added this bit of line after handling the POST Request.
res.sendStatus(403)
You can also confirm this by going to this url
https://api.telegram.org/<token>/getWebhookInfo
You'll see a property called pending_update_count. It should zero or close to it.

Resources