Giter Club home page Giter Club logo

imagebot's Introduction

Introduction

How to create serverless telegram chatbot to generate image using google app script and OpenAI Dall.E API from OpenAI.

image

Requirements

Getting Started - Google App Script Project

[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/imagebot_gas.txt

[3] Rename the project

Click on the "Untitled project" to rename the project as something else. Example, "My ChatGPT bot".

image

[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"

image

Click "Select type - Web App"

image

Fill in the form and click "Deploy". ( for more see https://www.youtube.com/watch?v=-AlstV1PAaA )

image

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.

image

Your telegram bot is ready !

Reference https://platform.openai.com/docs/guides/images/

imagebot's People

Contributors

wingsmaker avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

babyv0x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.