How to run telegram on a local n8n with docker

Describe the problem/error/question

I have n8n running locally. I’ve been googling this issue for a while now and can’t find a solution. I’m a hobbyist, not a computer scientist, so all the answers I find seem to go over my head. I host n8n through docker, and I am trying to get telegram to read messages/get audio/send as a AI/home Assistant. Doesn’t seem to connect? I get some webhook error. Does this mean I need to connect to telegram through a webhook? Is there another program I can use as an alternative? I’ve actually never used telegram before anyway, so i am not dependent on it.

This is also a fresh install (as far as I know) of n8n. All I did was git pull, change the directory name, edit the docker_compose, and run.

(Edit)
Can’t seem to get the workflow to paste properly. But it looks like this,

Telegram> Switch> 1 Audio, 2 Edit Fields> <1Audio - Transcribe> <2Edit Fields> > AI Agent> Telegram Send
Ai Agent> LLM Chain

Hope that helps. I can send a pic too if it works.

What is the error message (if any)?

Telegram Trigger: Bad Request: bad webhook: An HTTPS URL must be provided for webhook

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

I suspect that your n8n is being hosted locally on a non HTTPS site, that telegram trigger is essentially a webhook. If you want webhooks to work reliably you will need a domain and SSL cert.

Is that so. Yeah, I’m running completely local and offline. If thats the case, it seems more difficult to get that running properly. Do you know of an offline alternative, or a way to perform this through docker?

Ok well if the server is completely offline and not connected to any network then it would never be able to connect to telegram. I suspect you are just hosting it on a local machine on your home/business connection. If you have the auth working to telegram and can send messages using the API, then you could “poll” telegram for any new messages. You would basically do API hits every X amount of minutes/seconds to check for any new messages.

The instant trigger for telegram is a webhook, it basically setups up telegram to send a message to your API instance every time a new message is created. But since your server is behind a NAT and locally hosted telegram can’t send those messages, but your n8n can still request data.

Hello, I’m in the same situation as @croestalker and I’m wondering if running this all on a Render.com machine would fix the issue?

Using Docker + self-hosted n8n with a tunnel seems to generally “work” (it does provide an HTTPS endpoint for the webhook) except that Telegram needs the SSL certificate. I thought maybe running the same setup on a Render machine might be a relatively easy fix.

Can anyone confirm or deny?