🇹🇭 วิธีหา Facebook Access Token สำหรับ Post Facebook อัตโนมัติ
สรุปจากคลิปของช่อง Lin Davoy คลิปนี้เป็นภาคต่อจากเรื่องระบบ AI เขียนโพสต์อัตโนมัติ โดยเจาะลึกขั้นตอนที่หลายคนติดขัดที่สุด นั่นคือการไปหา Facebook Access Token มาให้ n8n หรือเครื่องมืออัตโนมัติอื่นๆ ใช้โพสต์ข้อความและรูปภาพเข้าเพจ Facebook แทนเราได้ โดยไม่ต้องเข้าไปโพสต์เองทุกครั้ง
ขั้นตอนที่ 1 สร้าง Facebook App
เริ่มจากเข้าไปที่หน้า Facebook Developers Apps เพื่อสร้าง Application ใหม่ขึ้นมาก่อน จากนั้นเข้าไปที่เมนู Setting แล้วเลือก Basic Setting เพื่อไปคัดลอกค่า App ID และ App Secret มาเก็บไว้ ค่าทั้งสองตัวนี้คือกุญแจสำคัญที่ระบบอัตโนมัติจะใช้ยืนยันตัวตนกับ Facebook
ขั้นตอนที่ 2 ไปเอา Token จาก Graph API Explorer
หลังจากมี App ID และ App Secret แล้ว ขั้นต่อไปคือเข้าไปที่ Graph API Explorer เพื่อสร้าง Access Token ตัวแรกออกมา ซึ่ง Token ที่ได้ตอนนี้จะเป็นแบบ Short-lived หมดอายุไว มักอยู่ได้ไม่กี่ชั่วโมงถึงไม่กี่วันเท่านั้น ยังใช้กับระบบอัตโนมัติระยะยาวไม่ได้
ขั้นตอนที่ 3 แปลงเป็น Token แบบไม่หมดอายุ
จุดที่ Lin ทำให้ง่ายขึ้นมากคือการเตรียม Form บน n8n ไว้ให้ แค่นำ Short Token ไปกรอกในฟอร์ม กดส่ง แล้วรอสักครู่ให้ระบบประมวลผล ระบบจะคืนโค้ด Token แบบ Long-lived หรือที่เรียกว่า Never Expires กลับมาให้ ซึ่งอ้างอิงมาจากเอกสารทางการของ Facebook เรื่อง Long-Lived Token โดยตรง ทำให้ไม่ต้องไปแกะสเปคเองให้เสียเวลา
ทำไมขั้นตอนนี้ถึงสำคัญ
ถ้า Token หมดอายุกลางทาง ระบบอัตโนมัติที่ตั้งไว้ เช่น การโพสต์ Facebook อัตโนมัติจากคลิปก่อนหน้า จะหยุดทำงานทันทีโดยไม่มีการแจ้งเตือนล่วงหน้า ดังนั้นการตั้งค่า Token แบบ Never Expires ตั้งแต่ต้นจึงช่วยลดปัญหาระบบล่มแบบไม่รู้ตัว และทำให้ไม่ต้องมานั่งขอ Token ใหม่ทุกๆ ไม่กี่วัน
สรุปแบบคนทำงานจริง
ในมุมคนทำงานจริง ขั้นตอนนี้ต้องทำแค่ครั้งเดียวตอนตั้งระบบ แต่ถ้าข้ามหรือทำพลาดจะทำให้ระบบอัตโนมัติทั้งหมดพังกลางทาง แนะนำให้ทำตามคลิปนี้ทีละขั้นอย่างละเอียด เก็บ App ID, App Secret และ Long-lived Token ไว้ในที่ปลอดภัย และตั้งปฏิทินเตือนตัวเองไว้ตรวจสอบทุกๆ สองสามเดือนเพื่อความชัวร์
🇬🇧 How to Get a Facebook Access Token for Automated Posting
This is summarized from the Lin Davoy channel. This clip is a follow-up to the AI-auto-posting workflow video, and it drills into the step that trips up the most people: getting a Facebook Access Token so n8n or any other automation tool can post text and images to a Facebook Page on your behalf, without you logging in and posting manually every time.
Step 1: create a Facebook App
Start on the Facebook Developers Apps page and create a new Application. Then go to Settings and open Basic Settings to copy out the App ID and App Secret. These two values are the credentials the automation will use to authenticate with Facebook.
Step 2: get a token from Graph API Explorer
With the App ID and App Secret in hand, the next step is the Graph API Explorer, where you generate your first Access Token. This first token is short-lived, often good for only a few hours to a few days, so it is not yet usable for a long-running automation.
Step 3: convert it into a never-expiring token
The part Lin makes much easier is a form she has already set up on n8n. Paste the short token into the form, submit it, wait a moment for the system to process, and it returns a long-lived, effectively never-expiring token. This is built directly on Facebook’s own Long-Lived Token documentation, so you do not have to reverse-engineer the spec yourself.
Why this step matters
If a token expires mid-flight, any automation depending on it, like the auto-posting workflow from the previous video, stops working immediately with no warning. Setting up a never-expiring token from the start avoids that silent failure and means you are not requesting a fresh token every few days.
The practical verdict
From a working practitioner’s view, this is a one-time setup step, but skipping it or getting it wrong will eventually break the whole automation. Follow this video step by step, store the App ID, App Secret, and long-lived token somewhere safe, and set a calendar reminder to check the token every couple of months just to be safe.
ติดตามข่าวสาร Data & AI ได้ที่:
Facebook: https://www.facebook.com/davoytech
YouTube: https://www.youtube.com/@linlinmhee
📌 อย่าลืมกด Like, Share และ Subscribe เป็นกำลังใจให้ด้วยนะคะ!
💬 ใครเคยติดปัญหา Token หมดอายุกลางทางบ้างคะ? มาเล่าประสบการณ์กันได้เลยค่ะ
#Davoy #DavoyTech #Linlinmhee #เรียนAI #คอร์สAI #DataAndAI #n8n #FacebookAPI #AIautomation #Facebook #AccessToken #GraphAPI
