connecting a telegram bot to a serverless pod
Hey guys, would love ur assist on the following issue,
i have a serverless function and i have an api endpoint from runpod, to which i can access using curl when providing an autorization in the http header,
the problem is when using /setWebhook when creating a telegram bot i need to provide an endpoint and i can't pass on parameters in the http request,
how should i approach this? i'd like to be able to send a message to a telegram bot that will trigger my serverless function that uses gpu
36 Replies
Google how to build Telegram bots and then make an API call from your telegram bot code that you host on a VPS.
is there a way to solve this without having a private server running at all time? if somehow i could expose an api endpoint that doesn't need authonication that would be ideal
You can use AWS Lambda or RunPod CPU serverless
You can't use a RunPod serverless endpoint without auth
with its sole purpose of adding the authorization to the api call? is that what everyone who connects their gpu instance to a telegram bot does?
Why would you want to do that? Peoplc can abuse it and rack up your RunPod account, its a very bad idea
yea i guess im just setting up an initial POC, was going to worry about authorization later, allowing people to create users etc..
runpod cpu serverless would still need to be authorized no? its the same problem
Yes If you use /run on serverless itll need your runpod API key
like the default gpu serverless
but for pods its more customizable
@nerdylive is there a way to both not have a running server at all time and to be able to forward the request without authenticating?
Im not sure how telegram bot works
One thing that might help is if I can transfer the autorization to run pod in the url, maybe as a query parameter?
Not sure if that is possible
Telegram allows u to connect a message to a post request to a url, but u can't authenticate using an http header authorization parameter
sure as a body, unless you're using pods you can pass it as query
Hm no then, serverless needs auth header
Hmm, that's strange since in the history of the chats in this discord people have created telegram bots that communicated with a serverless function, so I think I'm missing something
Where?
Its very easy to do it but you can't just magically run a telegram bot without infrastructure to host it.
I think so yeah you need a proxy in the middle to communicate to runpod serverless
I have just searched phrases like "telegram Bot" and seen people talking about theirs connecting to a serverless function
Exactly and it also needs to process the telegram messages.
you need an server to receive the message and act accordingly ( send request to runpod serverless )
Use AWS Lambda, you don't need an API key
And then the lambda just adds the api key and calls run pod?
Lambda is pretty cheap and can receive and send telegram messages and call RunPod Serverless API with the API key
You can store RP \api key somewhere within it yeah
I guess that will work, but I was thinking if aws lambda can expose a public api then so can the runpod 🥲
You can use AWS secrets manager for storing the API key
I guess I'll do that then, thank u guys!
That is not how RunPod serverless works
Hmm what if runpod serverless allows that
would that be ok
This kind of thing makes me concerned that people are going to come crying to RunPod when their balance is depleted.
RunPod serverless required authentication for a very good reason.
I mean if aws allows that I don't really see the difference
AWS also lets you expose any endpoint you want, not just /run, /runsync etc
So you are comparing apples with lemons
yeah sohuld be only for cpu hahah
Aws lambda specifically does allow u to expose the public api and that's the same as runpod cpu in my eyes
Yea maybe only for cpu
Incorrect, the design and architecture are completely different.
For sure behind the scenes, for they are intended for similar purposes product wise
Feel free to write it on #🧐|feedback
raz
Typically, you’d combine Lambda with API Gateway, which handles authentication or makes it open. Lambda itself often doesn’t need authentication because it’s mainly integrated with other AWS services like API Gateway, S3, and event processing. It also uses IAM roles to control access to other resource.