ChatGPT alike Google Chat using PaLM api ( v1 not v2 )
- Google Gmail account ( where your android playstore account is )
- Google PaLM api key , see https://beta.openai.com/account/api-keys
- Telegram chatbot token, see https://t.me/BotFather
[1] Goto https://script.google.com/home , click "New Project"
[2] Write the scripts, copy paste from below template url :
https://raw.githubusercontent.com/WingsMaker/chatgptbot/main/googleappscript.txt
[3] Rename the project
Click on the "Untitled project" to rename the project as something else. Example, "googlechatgpt".
[4] Deploy as google web app
In the Google App Script project, go to "Publish" in the top navigation bar. Under "Deploy as web app", select "Deploy". This will open a pop-up window. Your web app URL will be listed in the "Current web app URL" field.
Click on the "Deploy - New Deployment"
Click "Select type - Web App"
Fill in the form and click "Deploy". ( for more see https://www.youtube.com/watch?v=-AlstV1PAaA )
Copy the web app url to the clipboard for later use.
[5] Update the values of weburi in the script.
Remove the substrings "https://script.google.com/macros/s/" and "/exec" of url. Copy the result to clipboard. Change the value of statement, paste the weburi address into here.
var weburi = "paste_here";
[6] Update the values of token in the script.
Find your Telegram chatbot token by logging into the BotFather in Telegram, selecting your bot, and clicking the "API Token" button. ( see https://www.youtube.com/watch?v=aNmRNjME6mE ) Change the value of statement, paste the bot token into here.
var token = "replace_here";
[7] Update the values of apiKey in the script.
The api secret key for Chat GPT is located in the My Apps page of your Chat GPT dashboard. ( for more see https://www.youtube.com/watch?v=DFmmiYlbgX0 ) Change the value of statement, paste the api secret key into here.
var apiKey = "replace_here";
[8] Save the script and REDO the deployment process in step 4
since the code has been changed, need to update the value of webappUrl in [7].
[9] Run the "start_bot" function for only once to make sure actual telegram bot able to callback this google web app.
Your telegram bot is ready !