🎯 AI LINE Bot คืออะไร?
What is an AI-Powered LINE Bot?
🇹🇭 ภาษาไทย
AI LINE Bot คือบอทบน LINE ที่ใช้ปัญญาประดิษฐ์ (AI) เพื่อเข้าใจข้อความของผู้ใช้และตอบกลับอย่างชาญฉลาด แทนที่จะตอบตามสคริปต์ที่เขียนไว้ล่วงหน้าเท่านั้น
บอทธรรมดา (Rule-based Bot) ทำได้แค่จับคู่คำแล้วตอบตามที่โปรแกรมไว้ เช่น ถ้าผู้ใช้พิมพ์ "สวัสดี" → ตอบ "สวัสดีครับ"
AI Bot ฉลาดกว่ามาก! มันสามารถ เข้าใจความหมาย ของข้อความ, จำบริบทการสนทนา, และ สร้างคำตอบใหม่ ที่เหมาะสมกับแต่ละสถานการณ์
🇬🇧 English
An AI LINE Bot is a bot on the LINE messaging platform that uses artificial intelligence to understand user messages and respond intelligently, instead of just following pre-written scripts.
A regular (rule-based) bot can only match keywords and respond with pre-programmed answers. For example, if a user types "hello" → reply "hello!"
An AI Bot is much smarter! It can understand the meaning of messages, remember conversation context, and generate new answers that fit each situation.
🌟 Fun Facts — ข้อเท็จจริงน่าสนใจ
- LINE has over 54 million users in Thailand — that's about 75% of the population! — LINE มีผู้ใช้มากกว่า 54 ล้านคนในไทย!
- Thailand is LINE's biggest market outside Japan — ไทยเป็นตลาดที่ใหญ่ที่สุดของ LINE นอกญี่ปุ่น
- AI-powered bots can understand messages that they have never seen before — บอท AI เข้าใจข้อความที่ไม่เคยเห็นมาก่อนได้
- A single AI LINE bot can handle thousands of conversations at once — บอท AI ตัวเดียวรับมือการสนทนาพร้อมกันหลายพันรายการได้
🇹🇭 ทำไมต้องเรียนสร้าง AI LINE Bot?
- LINE เป็นแอปที่คนไทยใช้มากที่สุด
- ธุรกิจไทยต้องการ LINE bot ที่ฉลาด
- เรียนรู้ทักษะ AI ที่ใช้ได้จริงในงาน
- ฝึกภาษาอังกฤษผ่านการเขียนโค้ดและ API
🇬🇧 Why Learn to Build AI LINE Bots?
- LINE is the most popular app that Thai people use
- Thai businesses need bots that are smart and responsive
- Learn practical AI skills that apply to real jobs
- Practice English through coding and API documentation
🧪 Section Check — ตรวจสอบความเข้าใจ
AI LINE Bot Basics — พื้นฐาน AI LINE Bot
An AI LINE Bot is a bot ______ uses artificial intelligence to understand messages.
AI LINE Bot คือบอท______ใช้ปัญญาประดิษฐ์เพื่อเข้าใจข้อความ
What is the main difference between a rule-based bot and an AI bot?
อะไรคือความแตกต่างหลักระหว่างบอทแบบกฎเกณฑ์กับบอท AI?
LINE, ______ is the most popular messaging app in Thailand, has over 54 million Thai users.
LINE ______เป็นแอปส่งข้อความที่ได้รับความนิยมสูงสุดในไทย มีผู้ใช้ชาวไทยกว่า 54 ล้านคน
📚 คำศัพท์สำคัญ
Key Vocabulary
URL ที่รับข้อมูลอัตโนมัติเมื่อเกิดเหตุการณ์ LINE ส่งข้อความไปที่ webhook ของคุณ
ช่องทางที่โปรแกรมใช้คุยกัน LINE API ให้บอทส่งและรับข้อความ
โปรแกรมที่จำลองการสนทนากับผู้ใช้ แชทบอท LINE อยู่ในแอป LINE
เทคโนโลยี AI ที่ช่วยให้คอมพิวเตอร์เข้าใจภาษามนุษย์
สิ่งที่ผู้ใช้ต้องการทำ เช่น "อยากสั่งอาหาร" มี intent เป็นการสั่งอาหาร
ข้อมูลเฉพาะในข้อความ เช่น ชื่อ วันที่ สินค้า AI ดึง entity จากข้อความ
ข้อความที่บอทส่งกลับให้ผู้ใช้หลังประมวลผล
กระบวนการสอน AI ให้เข้าใจรูปแบบโดยให้ข้อมูลตัวอย่าง
เส้นทางที่วางแผนไว้สำหรับการสนทนา ตั้งแต่ทักทายจนทำงานเสร็จ
ความง่ายและน่าใช้ของบอท UX ที่ดีทำให้ผู้ใช้พอใจ
การเชื่อมต่อระบบต่างๆ เข้าด้วยกัน เช่น เชื่อม AI เข้ากับ LINE bot
ทำให้บอทพร้อมใช้งานจริง คือนำโค้ดขึ้นเซิร์ฟเวอร์ให้ทุกคนใช้ได้
🧪 Section Check — ตรวจสอบความเข้าใจ
LINE Bot Vocabulary — คำศัพท์ LINE Bot
A webhook is a URL ______ receives data automatically when an event happens.
Webhook คือ URL ______รับข้อมูลอัตโนมัติเมื่อเกิดเหตุการณ์
What does NLP (Natural Language Processing) do?
NLP (การประมวลผลภาษาธรรมชาติ) ทำอะไร?
An "intent" is what the user ______ to do. A developer ______ builds bots needs to understand user intents.
"Intent" คือสิ่งที่ผู้ใช้______ทำ นักพัฒนา______สร้างบอทต้องเข้าใจ intent ของผู้ใช้
📖 ไวยากรณ์ในบริบท AI LINE Bot
Grammar in Context: Relative Clauses
🔤 Relative Clauses: that / which / who
Relative Clauses (อนุประโยคขยายความ) ใช้เพื่อให้ข้อมูลเพิ่มเติมเกี่ยวกับคำนามในประโยค เชื่อมด้วย that, which, who
who = ใช้กับ คน | which = ใช้กับ สิ่งของ/สัตว์ | that = ใช้ได้ทั้งคนและสิ่งของ
มี 2 ประเภท:
1. Defining (จำกัดความ) — ข้อมูลจำเป็น ถ้าตัดออกความหมายเปลี่ยน (ไม่ใส่ comma)
2. Non-defining (ไม่จำกัดความ) — ข้อมูลเพิ่มเติม ตัดออกได้ความหมายไม่เปลี่ยน (ใส่ comma) ใช้ which/who เท่านั้น ห้ามใช้ that
✅ A chatbot is a program that responds automatically.
แชทบอทคือโปรแกรมที่ตอบกลับอัตโนมัติ (defining — บอกว่าเป็นโปรแกรมแบบไหน)
✅ The AI, which was trained on Thai data, understands Thai.
AI ซึ่งถูกฝึกด้วยข้อมูลไทย เข้าใจภาษาไทย (non-defining — ข้อมูลเพิ่มเติม ใส่ comma)
✅ The developer who built the bot speaks English.
นักพัฒนาที่สร้างบอทพูดภาษาอังกฤษ (defining — who สำหรับคน)
✅ The webhook, which receives all messages, must be secure.
webhook ซึ่งรับข้อความทั้งหมด ต้องปลอดภัย (non-defining)
❌ The AI, that was trained on data, understands Thai. → ✅ The AI, which was trained on data, understands Thai.
Non-defining clause ห้ามใช้ "that" ต้องใช้ "which" หรือ "who" เท่านั้น
💡 Grammar Tip — เคล็ดลับไวยากรณ์
Thai: ถ้ามี comma (,) ล้อมรอบ → non-defining → ใช้ which/who เท่านั้น (ห้าม that)
English: If there are commas around the clause → non-defining → use which/who only (never "that")
Quick Test: ลองตัดอนุประโยคออก ถ้าประโยคยังสมบูรณ์ = non-defining ถ้าความหมายเปลี่ยน = defining
🇹🇭 ตัวอย่างเพิ่มเติมกับ LINE Bot
- that: "A bot that uses AI can understand context." (defining)
- which: "LINE, which is popular in Thailand, supports bots." (non-defining)
- who: "Users who send messages get instant replies." (defining)
- which: "The API, which is free, lets you send messages." (non-defining)
🇬🇧 More Examples with LINE Bots
- that: "A bot that uses AI can understand context." (defining)
- which: "LINE, which is popular in Thailand, supports bots." (non-defining)
- who: "Users who send messages get instant replies." (defining)
- which: "The API, which is free, lets you send messages." (non-defining)
🧪 Section Check — ตรวจสอบความเข้าใจ
Relative Clauses — อนุประโยคขยายความ
The API, ______ is free to use, lets you send messages through LINE.
API ______ใช้ฟรี ให้คุณส่งข้อความผ่าน LINE
Which sentence uses a relative clause INCORRECTLY?
ประโยคไหนใช้ relative clause ผิด?
Users ______ send messages to the bot get instant AI-powered replies.
ผู้ใช้______ส่งข้อความไปที่บอทจะได้รับคำตอบจาก AI ทันที
🚀 เริ่มต้นสร้าง AI LINE Bot
Getting Started: Connecting AI to a LINE Bot
🇹🇭 สิ่งที่ต้องเตรียม
- บัญชี LINE (ที่คุณใช้อยู่แล้ว)
- บัญชี LINE Developers (สมัครฟรี)
- ความรู้พื้นฐานเรื่อง API (เรียนในบทนี้)
- AI service เช่น ChatGPT API หรือ Claude API
- เซิร์ฟเวอร์สำหรับรัน webhook (เช่น Render, Vercel)
🇬🇧 What You Need
- A LINE account (which you already have)
- A LINE Developers account (free to register)
- Basic knowledge of APIs (covered in this lesson)
- An AI service such as ChatGPT API or Claude API
- A server for running your webhook (e.g., Render, Vercel)
1สร้าง LINE Bot Channel — Create a LINE Bot Channel
2ตั้งค่า Webhook — Set Up Your Webhook
3เชื่อมต่อ AI — Connect AI to Your Bot
4ส่งคำตอบกลับ LINE — Reply to LINE
5ทดสอบและปรับปรุง — Test and Improve
💡 Pro Tip — เคล็ดลับมือโปร
Thai: เขียน system prompt ที่ดีให้ AI เช่น "You are a friendly Thai-English assistant that helps users who have questions about our products." จะทำให้บอทตอบได้ตรงจุดมากขึ้น!
English: Write a good system prompt for the AI, such as "You are a friendly Thai-English assistant that helps users who have questions about our products." This helps the bot give more relevant answers!
🛠️ โปรเจกต์ลงมือทำ
Hands-On Project: AI LINE Bot
Build a LINE Bot That Uses AI to Answer Questions 🔍 Medium
สร้าง LINE Bot ที่ใช้ AI ตอบคำถาม
เป้าหมาย: สร้าง LINE bot ที่เชื่อมต่อกับ AI เพื่อตอบคำถามของผู้ใช้ได้อย่างชาญฉลาด
บอทของคุณควร:
- รับข้อความจากผู้ใช้ผ่าน webhook
- ส่งข้อความไปให้ AI ประมวลผล
- ตอบกลับผู้ใช้ด้วยคำตอบจาก AI
- รองรับทั้งภาษาไทยและอังกฤษ
Goal: Build a LINE bot that connects to AI to answer user questions intelligently.
Your bot should:
- Receive messages from users via a webhook
- Send messages to AI for processing
- Reply to users with AI-generated answers
- Support both Thai and English languages
⚠️ Remember / จำไว้นะ
Thai: อย่าเผยแพร่ API Key ของคุณ! เก็บไว้ในตัวแปรสภาพแวดล้อม (environment variables) เสมอ
English: Never expose your API keys! Always store them in environment variables. A key that is leaked can be misused by anyone who finds it.
🧪 Section Check — ตรวจสอบความเข้าใจ
Building AI LINE Bots — การสร้าง AI LINE Bot
A Channel Access Token is a secret key ______ lets your bot send LINE messages.
Channel Access Token คือกุญแจลับ______ให้บอทของคุณส่งข้อความ LINE
A key ______ is leaked can be misused by anyone ______ finds it.
กุญแจ______ถูกเปิดเผย อาจถูกใช้ในทางที่ผิดโดยใครก็ตาม______พบมัน
📊 ตาราง LINE Bot + AI Terms
Reference Table
| Term | Thai / ไทย | Description |
|---|---|---|
| Webhook | เว็บฮุก | A URL that receives data when events happen — URL ที่รับข้อมูลเมื่อเกิดเหตุการณ์ |
| API (Application Programming Interface) | เอพีไอ | A way for programs to communicate — ช่องทางที่โปรแกรมใช้สื่อสารกัน |
| Channel Access Token | โทเค็นการเข้าถึงช่อง | A secret key that lets your bot send LINE messages — กุญแจลับที่ให้บอทส่งข้อความ LINE |
| Reply Token | โทเค็นตอบกลับ | A one-time token that is used to reply to a specific message — โทเค็นใช้ครั้งเดียวสำหรับตอบข้อความเฉพาะ |
| NLP (Natural Language Processing) | การประมวลผลภาษาธรรมชาติ | AI that understands human language — AI ที่เข้าใจภาษามนุษย์ |
| Intent | เจตนา | What the user wants — สิ่งที่ผู้ใช้ต้องการ |
| Entity | เอนทิตี | Key information extracted from messages — ข้อมูลสำคัญที่ดึงจากข้อความ |
| Conversation Flow | ลำดับการสนทนา | The planned path of a conversation — เส้นทางที่วางไว้ของการสนทนา |
| System Prompt | คำสั่งระบบ | Instructions that tell AI how to behave — คำสั่งที่บอก AI ว่าควรทำตัวอย่างไร |
| Deploy | ติดตั้ง/นำขึ้นใช้งาน | Making your bot available to real users — ทำให้บอทพร้อมใช้งานจริง |
| Fallback Response | คำตอบสำรอง | A response that is used when the bot doesn't understand — คำตอบที่ใช้เมื่อบอทไม่เข้าใจ |
| Rich Menu | เมนูริช | A custom menu that appears in LINE chat — เมนูที่กำหนดเองในแชท LINE |
🧪 Section Check — ตรวจสอบความเข้าใจ
Reference Table Review — ทบทวนตารางอ้างอิง
The webhook is the URL ______ LINE sends user messages to your server.
Webhook คือ URL ______LINE ส่งข้อความของผู้ใช้ไปยังเซิร์ฟเวอร์ของคุณ
A Rich Menu is a custom menu ______ appears at the bottom of a LINE chat.
Rich Menu คือเมนูที่กำหนดเอง______แสดงที่ด้านล่างของแชท LINE
A fallback response, ______ is used when the bot does not understand, should be friendly and helpful.
คำตอบสำรอง______ใช้เมื่อบอทไม่เข้าใจ ควรเป็นมิตรและมีประโยชน์
🎯 สรุป
Summary
🇹🇭 สิ่งที่คุณได้เรียนรู้
- AI LINE Bot คืออะไรและแตกต่างจากบอทธรรมดาอย่างไร
- คำศัพท์สำคัญ: webhook, API, NLP, intent, entity, deploy
- Relative Clauses: that/which/who (defining vs non-defining)
- ขั้นตอนการเชื่อมต่อ AI กับ LINE Bot
- การสร้างบอทที่ตอบคำถามด้วย AI
🇬🇧 What You Have Learned
- What AI LINE bots are and how they differ from rule-based bots
- Key vocabulary: webhook, API, NLP, intent, entity, deploy
- Relative Clauses: that/which/who (defining vs non-defining)
- The steps that are needed to connect AI to a LINE Bot
- How to build a bot that answers questions using AI
🎉 ยินดีด้วย! / Congratulations!
คุณพร้อมสร้าง AI LINE Bot แล้ว!
You now know the concepts that are needed to build a smart LINE bot! The AI, which you will connect to LINE, will make your bot truly intelligent! Developers who master these skills are in high demand! 🤖
🧪 Final Review — ทบทวนสุดท้าย
AI + LINE Bot & Relative Clauses — ทบทวนทั้งหมด
Developers ______ build LINE bots need to register on the LINE Developers website.
นักพัฒนา______สร้าง LINE bot ต้องสมัครบัญชีที่เว็บไซต์ LINE Developers
LINE Developers, ______ is the website where you create bot channels, is free to use.
LINE Developers ______เป็นเว็บไซต์ที่คุณสร้าง bot channels ใช้ฟรี
What are the correct steps to build an AI LINE bot?
ขั้นตอนที่ถูกต้องในการสร้าง AI LINE bot คืออะไร?