Telegram Problems

Hi,

I have linked my telegram with n8n. When a workflow is finished or if I have to confirm something I get a message in my telegram, but if I have a trigger with updates message and then on trigger on message and I go to the bot that I have linked with the api and send a message there then nothing happens.

Do you know what else I can check?

If i click in the cloud add field. I get only 1 optie that is download image. On my hosting server i get 3 optes: Restrict to chat IDs, Restrict to User IDs and download imgae.

The API works in the cloud from n8n but not on my server.


  • **n8n version: 1.86.1
  • **Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • **Operating system: Linux

When running on your server, you mean you are on localhost? If so, when inspecting the webhook, what are the urls for production en testing.

And sharing your workflow will help in determine what might be the problem

Copy your WF en paste it in the chat using the ‘</>’ button.

Hi Sebas,

I have an linux server with docker so yes is an localhost.

The webhook is this: https://n8n.nexer-hosting.nl/webhook/9ca5c263-8d33-4893-bbaf-42261dc3759a/webhook so did looks good.

The is for now not an workflow. What i what is an message from telegram the output off that. This is an trigger

It sounds to me you want telegram to listen for a message, then respond to that message by sending a message to the bot, and then react to that.

If that is the case, it will not work, the telegram trigger listens for message from others not himself.

So in a sense it sown message is not an incoming message that will trigger an event.

If I am wrong then I still say, please post what you have as a WF test.

Maybe I am not completely clear. Here is the workflow.

What happens is I send a message to a telegram bot for example keyword IT. The workflow is then started and will research this keyword. I can also do this with an http website. If I go to my bot in telegram that I have made and I send a url in the bot then the trigger will start. Hence trigger on message.

Ok some considerations, the webhook you mention will have to point to your local n8n which address is most likely

localhost:5678

A similar setup on my side is with ngrok adress pointing to my n8n installation running in Docker works fine in Prod and Test

INIT:

ngrok http http://localhost:5678

Then the Telegram API needs to be informed

you can use:
Replace [yourid] with the BOT id and [ngrokIP] with the provided url from ngrok

https://api.telegram.org/bot[yourid]/setWebhook?url=[ngrokIP]

And you will have to spin up your docker container with the same url

Example:

docker run -itd \
 --name n8n \
 --restart always \
 --network inside_network \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="Europe/Amsterdam" \
 -e TZ="Europe/Amsterdam" \
 -e WEBHOOK_TUNNEL_URL="[ngrokurl]/" \
 -e WEBHOOK_URL="[ngrokurl]/" \
 -v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n:latest

So now if you activate your n8n WF and send a message from the BOT the n8n WF will be triggered.

Ah okay i will try it out.

How do i get my bot ID for the chat?

When you created your bot, you used BotFather, after you created the BotName it will have responded with

I altered my text below, but yout BOT id would be at […]

Done! Congratulations on your new bot. You will find it at t.me/[yourbotname]. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
[......]
Keep your token secure and store it safely, it can be used by anyone to control your bot.

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

If you lost that, then you can retrieve your BOT / HTTP Api at BotFather in telegram

1 open telegram
2 goto the channel BotFather
3 type /mybots
4 choose the correct bot (if you have more then 1)

it will respond with the ID

Here is the token for bot [yourbotname]:

[......]