Core: Telegram returned an invalid response! Please review your bot name and API key.

Created on 18 Mar 2017  路  10Comments  路  Source: php-telegram-bot/core

Required Information

  • PHP Telegram Bot version:0.39.0
  • Using MySQL database: yes
  • Update Method: Webhook
  • Self-signed certificate: no

Actual behaviour

Bot isn't responding, also set.php returns:
Longman\TelegramBot\Exception\TelegramException: Telegram returned an invalid response! Please review your bot name and API key.

Steps to reproduce

API key is correct, double-checked and is fine. Bot stopped working yesterday.

All 10 comments

I wrote BotSupport (Telegram) about this, and they answer this:

What exact answer do you get when calling getWebhookInfo? That should give some info.
getWebhookInfo returns:

{"ok":true,"result":{"url":"https://mydomain.com/hook.php","has_custom_certificate":false,"pending_update_count":0,"max_connections":40,"allowed_updates":["message","channel_post","inline_query","chosen_inline_result","callback_query"]}}

It doesn't seems that there are any pending updates. It seems that, at least, you are receiving the updates, do you get any error when you try to answre them?

debug.log:

upload completely sent off: 2512 out of 2512 bytes
< HTTP/1.1 200 OK
< Server: nginx/1.10.0
< Date: Fri, 17 Mar 2017 16:42:23 GMT
< Content-Type: application/json
< Content-Length: 5054
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET, POST, OPTIONS
< Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection
< Strict-Transport-Security: max-age=31536000; includeSubdomains
<

  • Connection #0 to host api.telegram.org left intact

[] []
[2017-03-17 17:11:30] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

[] []
[2017-03-17 17:12:26] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

[] []
[2017-03-17 17:12:30] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

[] []
[2017-03-17 17:18:10] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

[] []
[2017-03-17 17:41:32] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

[] []
[2017-03-17 17:41:50] bot_log.DEBUG: Verbose HTTP Request output:

  • Could not resolve host: api.telegram.org
  • Closing connection 0

Could not resolve host: api.telegram.org

Obviously the server can't connect to the API, this is something that isn't library's fault I think.

Tried setting the webhook manually? (creating url with variables)

Suddenly I got that error, will contact my server admin and update this topic

If you have access to hosts file you could try to manually specify the IP there, but I wouldn't recommend it for future use.

root@ubuntu:# ping api.telegram.org
ping: unknown host api.telegram.org
root@ubuntu:# ping google.com
ping: unknown host google.com

Looks like there is some problem with /etc/resolv.conf

I have the same problem. My hook works, but when I run script to send some messages I receive "Telegram returned an invalid response! Please review your bot name and API key." . But API key is common for hook and send message script.

Have you some solution already?

@dzarezenko Could you give us more info of your situation/setup?

Sorry, looks like it was problem with SSL certificate configuration. We can send messages without certificate configured and I have coded sending at first. When I configured certificate for hook, sending stopped work. It was certificate problem.

Thank you for your help!

Was this page helpful?
0 / 5 - 0 ratings