Step 1: Sign up ChatGPT API from RapidAPI or use official ChatGPT API from OpenAI
Step 2: Create two IFTTT Applets
- 1. Maker Webhook to Telegram @IFTTT bot
If This (Webhook Trigger event)
Then that (Telegram response ChatGPT answer)
If Maker Event "chatgpt", then Send message to Private chat with @IFTTT
- 2. Send a message with #GPT hashtag to Telegram @IFTTT bot to trigger ChatGPT message to make a web request
If this (Telgram ask question with #GPT hashtag)
Then that (Webhook Make a web request)
If New message to @IFTTT with '#gpt', then Make a web request
- Step 3: Write node.js application
- Listening at local host @3000
- Make localhost public accessible URL using
- https://localtunnel.me/
localtunnel is available as a npm package, so you can install it with:
npm install -g localtunnel
Execute the lt
command:
lt --port 3000
This will setup a tunnel to you local server on port 3000, and give you a public URL that will remain active even if you restart or stop your server:
- Reference Guide: https://www.pluralsight.com/guides/exposing-your-local-node-js-app-to-the-world
- Step 4: Update this new generated public URL to the step 1 second Applet to it accessible from public to make web request for ChatGPT question from Telegram
- Step 5: Start node.js application
node app.js
- or
node start
- Step 6: Go to http://localhost:3000/ or your public URL.
Demo with Local Input
- Step 7: We can either ask question from our localhost or go to telegram to enter our ChatGPT questions.
16 projects • 121 followers
I'm an Embedded Software Engineer who like DIY electronic. linkedin.com/in/faweiz
Comments
Please log in or sign up to comment.