-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⚡ Add apiEndpoint to Telegram credentials #2517
Conversation
Hi @ivov, Should I add manually reviewers? |
Hey @m2scared, Just looking at this one, Do you have an example in mind as to when this option would be used? Looking at the pull request for the Go library they added it a few years ago incase there was a change to the Telegram API URL and it allows some limited testing as you could send the data to your own server or something like pipedream to check it. Were you thinking about the same thing for n8n? |
Hi @Joffcom Thanks for taking a look. Currently I am using it as a Telegram API Proxy. My proxy server checks the requests and fake some responses. This my current use case. Another interesting ones would be testing and auditing. |
The proxy server can deny some requests depending on who made it. |
Hey @m2scared, That sounds like a good use case as well, I will give it a review and test this afternoon and we can hopefully get this one merged in and closed off for you. |
Thanks. One thing I notice is that it may cause problems if you have an existing Telegram configuration. Is there a way to guarantee that upgrades will not break running clients? |
Hey @m2scared, That would be a bit of a problem, What I would do is check if the "Advanced" toggle is enabled or not then set the value based on that which removes the risk of breaking the node. const uri = credentials.advanced ? formatString(`${credentials.apiEndpoint}`, `${credentials.accessToken}`, endpoint) : `https://api.telegram.org/bot${credentials.accessToken}/${endpoint}`; I did wonder if the {0}/{1} is even needed maybe it is enough to just set the base URL as I suspect it will always be bot{0} for the token and / {1} for the action so that then changes the above a bit more as you wouldn't need the extra formatString() function. There are also 3 other parts that ignore the advanced option fully which may need to be thought about.
Let me know what you think. |
Hey @Joffcom,
I will add that.
Since the Golang added it I thought would be good to keep. But I have no good reasons besides that.
Let me check them. I think they should check. |
2c8c1b2
to
ebf4ed3
Compare
Create an advanced option for setting custom Telegram's apiEndpoint. Inspired by https://github.com/go-telegram-bot-api/telegram-bot-api/blob/3834565c356e9b2d94bd8080555aeaf795bbb0ea/bot.go#L100
ebf4ed3
to
f387a7d
Compare
Hey @Joffcom, I believe I have addressed all the issues. Could you take a look? |
Hey @m2scared, I will take a look this afternoon 👍🏻 |
Hey @m2scared, Looks good to me, I will write up the "Why" behind this change on our internal system and we can see what happens from there. Thanks for going through the changes 👍🏻 |
Hi m2scared, thanks for your contribution! |
No problem @nivb06. Thanks for the feedback. |
@nivb06 this PR is pretty useful and I hope you'll give it another chance. |
Create an advanced option for setting custom Telegram's apiEndpoint.
Inspired by https://github.com/go-telegram-bot-api/telegram-bot-api/blob/3834565c356e9b2d94bd8080555aeaf795bbb0ea/bot.go#L100