krnbatra / SplitwiseTelegramBot

Telegram Bot for managing Splitwise
MIT License
13 stars 3 forks source link

User connection problem #1

Open den2204 opened 3 years ago

den2204 commented 3 years ago

How can I connect user if I try to run it locally? I understood that we cant wait result in connect handler, but we need to prepare server's answer somewhere. I found database change only in start handler, but this code isn't reachable from connect hanlder. Could you explain what should I fix, because I am really confused now. Thank you!

krnbatra commented 3 years ago

Hey,

That's a really good question! Please go through this StackOverflow question: Telegram bot - OAuth authorization , specifically this answer: Answer.

Essentially you will need to register an API in AWS API Gateway which you will enter in your Splitwise account redirect URI. The function of the API would be to take the tokens you got from Splitwise and call the https://telegram.me/my_bot?start=<auth_code>, which will be received in the start handler

If you face the problem of creating an API and passing multiple parameters into a single one, go through this link. Stackoverflow Question

Thanks!