Notion credentials#
คุณสามารถใช้ credentials เหล่านี้เพื่อยืนยันตัวตนใน nodes ต่อไปนี้:
Prerequisites#
สร้างบัญชี Notion ที่มีสิทธิ์ระดับ admin
Supported authentication methods#
- API integration token: ใช้สำหรับ internal integrations
- OAuth2: ใช้สำหรับ public integrations
Integration type
ไม่แน่ใจว่าจะใช้ integration type ไหน? อ้างอิง Internal vs. public integrations ด้านล่างสำหรับข้อมูลเพิ่มเติม
Related resources#
อ้างอิง Notion's API documentation สำหรับข้อมูลเพิ่มเติมเกี่ยวกับบริการนี้
Using API integration token#
ในการกำหนดค่า credential นี้ คุณจะต้องมี:
- Internal Integration Secret: สร้างขึ้นเมื่อคุณสร้าง Notion integration
วิธีสร้าง integration secret ให้ สร้าง Notion integration และรับ integration secret จากแท็บ Secrets:
- ไปที่ integration dashboard ของ Notion
- เลือกปุ่ม + New integration
- ป้อน Name สำหรับ integration ของคุณ เช่น
n8n integration
หากต้องการ ให้เพิ่ม Logo - เลือก Submit เพื่อสร้าง integration ของคุณ
- เปิดแท็บ Capabilities เลือก capabilities เหล่านี้:
Read content
Update content
Insert content
User information without email addresses
- อย่าลืม Save changes
- เลือกแท็บ Secrets
- คัดลอก Internal Integration Token และเพิ่มเป็น Internal Integration Secret ของ n8n
อ้างอิงเอกสาร Internal integration auth flow setup documentation สำหรับข้อมูลเพิ่มเติมเกี่ยวกับการยืนยันตัวตนกับบริการ
Share Notion page(s) with the integration#
เพื่อให้ integration ของคุณโต้ตอบกับ Notion ได้ คุณต้อง ให้สิทธิ์ integration ของคุณในการเข้าถึง page ใน Notion workspace ของคุณ:
- ไปที่ page ใน Notion workspace ของคุณ
- เลือกเมนูสามจุดที่มุมขวาบนของ page
- ใน Connections เลือก Connect to
- ใช้แถบค้นหาเพื่อค้นหาและเลือก integration ของคุณจากรายการดรอปดาวน์
เมื่อคุณแชร์อย่างน้อยหนึ่ง page กับ integration แล้ว คุณสามารถเริ่มส่งคำขอ API ได้ หาก page ไม่ได้ถูกแชร์ คำขอ API ใดๆ ที่ส่งไปจะตอบกลับด้วยข้อผิดพลาด
อ้างอิง Integration permissions สำหรับข้อมูลเพิ่มเติม
Using OAuth2#
ในการกำหนดค่า credential นี้ คุณจะต้องมี:
- Client ID: สร้างขึ้นเมื่อคุณกำหนดค่า public integration
- Client Secret: สร้างขึ้นเมื่อคุณกำหนดค่า public integration
คุณต้อง สร้าง Notion integration และตั้งค่าเป็นการเผยแพร่แบบสาธารณะ (public distribution):
- ไปที่ integration dashboard ของ Notion
- เลือกปุ่ม + New integration
- ป้อน Name สำหรับ integration ของคุณ เช่น
n8n integration
หากต้องการ ให้เพิ่ม Logo - เลือก Submit เพื่อสร้าง integration ของคุณ
- เปิดแท็บ Capabilities เลือก capabilities เหล่านี้:
Read content
Update content
Insert content
User information without email addresses
- เลือก Save changes
- ไปที่แท็บ Distribution
- เปิดใช้งานตัวควบคุม Do you want to make this integration public?
- ป้อนชื่อบริษัทและเว็บไซต์ของคุณในส่วน Organization Information
- คัดลอก OAuth Redirect URL ของ n8n และเพิ่มเป็น Redirect URI ในส่วน OAuth Domain & URLs ของ Notion integration
- ไปที่แท็บ Secrets
- คัดลอก Client ID และ Client Secret และเพิ่มลงใน credential ของ n8n
อ้างอิง public integration auth flow setup ของ Notion สำหรับข้อมูลเพิ่มเติมเกี่ยวกับการยืนยันตัวตนกับบริการ
Internal vs. public integrations#
Internal integrations คือ:
- เฉพาะสำหรับ workspace เดียว
- เข้าถึงได้เฉพาะสมาชิกของ workspace นั้น
- เหมาะสำหรับการปรับปรุง workspace แบบกำหนดเอง
Internal integrations ใช้กระบวนการยืนยันตัวตนที่ง่ายกว่า (integration secret) และไม่ต้องมีการตรวจสอบความปลอดภัยก่อนเผยแพร่
Public integrations คือ:
- ใช้งานได้ในหลาย Notion workspaces ที่ไม่เกี่ยวข้องกัน
- เข้าถึงได้โดยผู้ใช้ Notion ทุกคน โดยไม่คำนึงถึง workspace ของพวกเขา
- เหมาะสำหรับกรณีการใช้งานที่หลากหลาย
Public integrations ใช้โปรโตคอล OAuth 2.0 สำหรับการยืนยันตัวตน ต้องมีการตรวจสอบความปลอดภัยของ Notion ก่อนเผยแพร่
สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับ integration ทั้งสองประเภท อ้างอิงเอกสาร Internal vs. Public Integrations documentation ของ Notion