วิธีทำให้ไฟล์ใน LINE ไม่หายตลอดไป ด้วย n8n + Google Drive | Never Lose Your LINE Files Again with n8n (TH/EN)

🇹🇭 วิธีทำให้ไฟล์ใน LINE ไม่หายตลอดไป ด้วย n8n + Google Drive

ปัญหาโลกแตกอันดับ 1 ของคนที่ทำงานผ่าน LINE ก็คือ “ไฟล์หาย” ค่ะ ไม่ว่าจะเป็นรูปหรือไฟล์เอกสาร พอเวลาผ่านไปไฟล์หมดอายุ กดโหลดไม่ได้ ต้องวนไปขอกันใหม่ทุกที ทั้งที่คนไทยเราก็ทำงานกันผ่าน LINE เป็นหลักเสียด้วย บทความนี้สรุปจากคลิปของช่อง Lin Davoy ที่สอนวิธีแก้ปัญหานี้แบบถาวรด้วย automation ตัวเดียว ใช้เวลาเซตจริง ๆ ไม่เกิน 10 นาที

แนวคิด: บอทที่คอยเก็บไฟล์เข้า Google Drive ให้อัตโนมัติ

คอนเซปต์ง่ายมากค่ะ เราจะสร้าง LINE Official Account ขึ้นมา 1 ตัว (ในคลิปตั้งชื่อว่า “ไฟล์ไม่หายตลอดไป”) แล้วลากน้องเข้าไปอยู่ในกรุ๊ปที่เราคุยงานกัน เมื่อไหร่ก็ตามที่มีคนส่งไฟล์หรือรูปเข้ากรุ๊ป น้องจะทำงานเป็น webhook วิ่งไปดึงไฟล์นั้นมา แล้วอัปโหลดเก็บไว้ใน Google Drive ให้เราทันที ไฟล์เลยไม่มีวันหมดอายุอีกต่อไป

เครื่องมือที่ใช้คือ n8n ซึ่งเป็นโปรแกรม automation ที่ใช้ฟรีได้ (หรือจะจ่ายรายเดือนแบบ cloud ก็ได้) เหตุผลที่เลือก n8n เพราะมันเป็น visual workflow มองเห็นภาพง่าย เหมาะกับการสอน แต่จริง ๆ แล้ว concept เดียวกันนี้จะเอาไปทำด้วย Google Apps Script หรือเครื่องมืออื่นก็ได้เช่นกัน ข้อจำกัดเดียวที่ต้องรู้ก่อนคือ ใน 1 กรุ๊ป LINE จะมี LINE OA ได้แค่ 1 ตัวเท่านั้น ถ้ากรุ๊ปนั้นมี LINE OA อยู่แล้ว ต้องไปปรับ workflow จาก OA ตัวเดิมแทนค่ะ

สเต็ปที่ 1 — สร้าง LINE OA แล้วเชิญเข้ากรุ๊ป

สร้าง LINE Official Account ขึ้นมาก่อน (วิธีสร้างมีสอนแยกอีกคลิปหนึ่งของช่อง) จุดสำคัญคืออย่าลืมเข้าไปที่ account settings แล้วเปิดสิทธิ์ให้ OA เข้าร่วมกรุ๊ปได้ด้วย ไม่อย่างนั้นพอเชิญเข้ากรุ๊ปน้องจะเด้งออกทันที พอเปิดแล้วก็ invite น้องเข้ากรุ๊ปที่เราคุยงานได้เลย จะเป็นกรุ๊ปคุยกับเพื่อนหรือกรุ๊ปทำงานก็ได้ทั้งนั้นค่ะ

สเต็ปที่ 2 — ต่อ webhook จาก LINE เข้า n8n

ใน n8n ให้สร้าง workflow ที่เริ่มด้วย Webhook node แล้ว copy URL มา จุดที่คนพลาดบ่อยคือ URL ระหว่างเทสจะมีคำว่า test ติดอยู่ พอใช้งานจริงต้องสลับไปใช้ Production URL แทน จากนั้นไปที่ LINE OA ของเรา เข้า Response settings เปิดใช้งาน webhook (ถ้าไม่เปิด ข้อมูลจะไม่วิ่งมา) แล้วเอา URL ไปวางใน Manage API settings กด Save ทีนี้พอลองส่งข้อความทดสอบเข้ากรุ๊ป ข้อมูลก็จะวิ่งเข้ามาที่ n8n ให้เห็นเลยค่ะ

ต่อมาใส่ Filter node กรองว่า message type is not equal to “text” เพื่อให้ workflow ทำงานเฉพาะตอนมีคนส่งไฟล์หรือรูปเท่านั้น ข้อความคุยเล่นธรรมดาจะไม่ถูกเก็บ ส่วนที่ซับซ้อนขึ้นนิดหนึ่งคือ LINE จะไม่ส่งตัวไฟล์มาตรง ๆ แต่ส่งมาเป็น Message ID เราจึงต้องยิง HTTP request ไปขอไฟล์อีกรอบ โดยสร้าง Header Auth credential ใส่ค่าเป็นคำว่า Bearer ตามด้วยเว้นวรรค 1 ครั้ง แล้วต่อด้วย Channel Access Token ซึ่งไปกดปุ่ม Issue ได้จาก LINE Developers Console ในแท็บ Messaging API (เลื่อนลงล่างสุด) พอเซตเสร็จลอง execute step ก็จะได้ไฟล์กลับมาเป็น data เรียบร้อย

สเต็ปที่ 3 — อัปโหลดเข้า Google Drive

ขั้นสุดท้ายง่ายที่สุดค่ะ สร้างโฟลเดอร์ใหม่ใน Google Drive ตั้งชื่อเดียวกับ LINE OA จะได้หาเจอง่าย ๆ แล้วใน n8n ก็เพิ่ม Google Drive node เลือก Connect Google Account เลือก My Drive และโฟลเดอร์ที่เพิ่งสร้าง กด execute step น้องก็จะเอาไฟล์ที่ส่งใน LINE มาวางไว้ในโฟลเดอร์ให้ทันที ถ้าไฟล์เยอะ ๆ จะตั้งกติกาการตั้งชื่อไฟล์อัตโนมัติก็ได้ หรือเอาแบบง่าย ๆ ก็เข้าไปเรียงตาม date modified แล้ว rename เอาทีหลังก็ได้เช่นกัน

ก่อนใช้งานจริงอย่าลืม 2 อย่าง คือสลับ webhook URL ใน LINE เป็น Production URL (ลบคำว่า test ออก) แล้วกด Save และอย่าลืมกด Publish workflow ใน n8n ด้วย จากนั้นจะส่งกี่ไฟล์ก็เก็บหมด ในคลิปลองส่ง PDF เข้าไปก็งอกขึ้นมาใน Drive เรียบร้อยค่ะ

มุมคนทำงานจริง

ในมุมคนทำงานจริง การลงทุนเซตระบบ 10 นาทีแลกกับการไม่ต้องไล่ขอไฟล์ที่หมดอายุอีกตลอดไป ถือว่าคุ้มมาก และแนวคิดสำคัญจากคลิปคือ เราเปลี่ยนพฤติกรรมคนอื่นในกรุ๊ปไม่ได้ แต่เราเริ่มเปลี่ยนที่ตัวเองได้ ด้วยการให้บอทเก็บไฟล์แทนเรา นอกจากเก็บไฟล์แล้ว automation แบบนี้ยังพลิกแพลงไปทำอย่างอื่นได้อีกเยอะ เช่นคลิปถัดไปของช่องที่จะสอนดึงใจความสำคัญจากแชทไปทำ meeting note อัตโนมัติ สรุปจากคลิปของช่อง Lin Davoy ค่ะ


🇬🇧 Never Lose Your LINE Files Again with n8n + Google Drive

The number-one headache for anyone working through LINE: files expire and disappear. Photos, documents — after a while the download just fails, and you have to ask everyone to resend. Since so many Thai teams run their entire workflow on LINE, this post (summarized from a video on the Lin Davoy channel) shows a permanent fix using automation. Real setup time: under 10 minutes.

The concept: a bot that archives every file to Google Drive

Create a LINE Official Account (in the video it is named “Files Never Lost”), invite it into your work group, and let it act as a webhook. Whenever someone sends a file or image, the bot fetches it and uploads it straight to Google Drive. The tool of choice is n8n — a visual automation platform you can run for free (self-hosted) or pay monthly for the cloud version. The same concept also works with Google Apps Script. One limitation to know upfront: a LINE group can only contain one LINE OA, so if your group already has one, you will need to build the workflow on that existing OA instead.

Step 1 — Create the LINE OA and invite it to your group

Set up a LINE Official Account, then — crucially — go into the account settings and allow it to join group chats. If you skip this, the bot gets bounced out the moment you invite it. Once enabled, add it to any group you work in.

Step 2 — Wire the LINE webhook into n8n

In n8n, start a workflow with a Webhook node and copy its URL. Note that the test URL contains the word “test” — for real use you must switch to the Production URL. In your LINE OA, open Response settings, enable webhooks (data will not flow otherwise), and paste the URL under Manage API settings. Send a test message to the group and you should see the payload arrive in n8n.

Next, add a Filter node: message type is not equal to “text”, so only files and images trigger the flow. Here is the slightly tricky part: LINE sends only a Message ID, not the file itself, so you need an HTTP request to fetch the actual content. Create a Header Auth credential whose value is the word Bearer, one space, then your Channel Access Token — issued at the bottom of the Messaging API tab in the LINE Developers Console. Execute the step and the file comes back as data.

Step 3 — Upload to Google Drive

Create a new Drive folder named after your LINE OA so it is easy to find. In n8n, add the Google Drive node, connect your Google account, pick My Drive and that folder, and execute. The file you sent in LINE appears in the folder immediately. Before going live, switch to the Production URL in LINE settings and hit Publish on the n8n workflow. From then on, every file — the video tests a PDF too — is archived automatically.

Practitioner takeaway

Ten minutes of setup buys you a permanent end to chasing expired files. You cannot change how other people in the group behave, but you can change your own setup — let the bot do the archiving. And this pattern extends far beyond file storage: a follow-up video will turn LINE chatter into automatic meeting notes. Summarized from the Lin Davoy channel.


ติดตามข่าวสาร Data & AI ได้ที่:
Facebook: https://www.facebook.com/davoytech
YouTube: https://www.youtube.com/@linlinmhee

📌 อย่าลืมกด Like, Share และ Subscribe เป็นกำลังใจให้ด้วยนะคะ!

💬 เคยเจอไฟล์สำคัญใน LINE หมดอายุตอนที่ต้องใช้พอดีไหมคะ? ลองเล่าเคสของคุณ หรือถามขั้นตอนการเซต n8n ตรงไหนก็ได้ในคอมเมนต์เลยนะคะ

#Davoy #DavoyTech #Linlinmhee #เรียนAI #คอร์สAI #DataAndAI #n8n #LINE #Automation #GoogleDrive #NoCode

Chat Widget - Davoy.tech