A chat app integrate with ChatGPT
- Get API token from OpenAI
- Get Line token:
- Go to Line Developers
- Create a new provider
- Create a new channel
- Get channel access token and channel secret
- Rename
template.env
to.env
and update the value - Run
bundle install
- Run server via
rails s
- Start ngrok by running the command
./ngrok http 3000
(assuming your Rails app is running on port 3000). This will create a secure tunnel from the internet to your local machine. - Copy the ngrok URL (e.g. https://randomstring.ngrok.io) from the output of the previous command.
- Set the webhook URL for your Line channel to the ngrok URL by running the following command in your terminal:
curl -v -X PUT https://api.line.me/v2/bot/channel/webhook/endpoint \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_CHANNEL_ACCESS_TOKEN' \
-d '{"endpoint": "https://randomstring.ngrok.io/callback"}'
- Chat with your bot