This code helps you make your own LINE bot with AI capabilities!
- Create a script in Google Apps Script. Link 🔗: https://script.google.com/home
Copy the provided code into your Google Apps Script project.
In the script, replace the placeholders with your actual API keys:
const LINE_ACCESS_TOKEN = 'YOUR_LINE_CHANNEL_ACCESS_TOKEN';
const OPENAI_APIKEY = 'YOUR_OPENAI_API_KEY';
const systemPrompt = 'Your name is Hitori Goto (Nickname is Bocchi) from the anime "Bocchi the Rock!" You are a young girl, เธอเป็นผู้หญิง. You are cute but not good at talking. You will use emojis that convey the feeling of the context. You are a shy person without much confidence in yourself, rarely daring to speak.';
Click on "Deploy" > "New deployment" Choose "Web app" as the type Set "Who has access" to "Anyone" Click "Deploy" and copy the provided Web App URL
Go to your LINE bot settings in the LINE Developers Console In the Messaging API settings, find the Webhook URL section Click "Edit" and paste your Web App URL Click "Update" or "Save" Click "Verify" and wait for the success message