คู่มือการใช้งาน Image Overlay API กับ n8n และระบบอื่นๆ
เริ่มต้นใช้งาน API ได้ทันทีใน 3 ขั้นตอน:
ไปที่ Template Editor แล้วสร้าง template พร้อมกำหนด variables
หลังจาก save template URL จะเปลี่ยนเป็น /editor/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
API รองรับ 2 วิธีในการยืนยันตัวตน:
สร้างรูปภาพจาก template
| Parameter | Type | Description |
|---|---|---|
api_key |
Required | API Key สำหรับยืนยันตัวตน |
{variable_name} |
Optional | ค่า variables ที่กำหนดใน template |
format |
Optional | รูปแบบไฟล์: jpg, png, webp (default: jpg) |
quality |
Optional | คุณภาพรูป: 1-100 (default: 90) |
สร้างหลายรูปพร้อมกันในครั้งเดียว (สูงสุด 100 รูป)
วิธีเชื่อมต่อ API กับ n8n workflow
คลิกปุ่ม Copy แล้วไปที่ n8n กด Ctrl+V เพื่อวาง Node
| Method | GET หรือ POST |
| URL | https://api.mpkbm.com/api/generate/{template_id} |
| Authentication | None (ใส่ api_key ใน query หรือ header) |
{{ $json.fieldName }} เพื่อดึงค่าจาก node ก่อนหน้า
สร้างรูปอัตโนมัติจากข้อมูลใน Google Sheets
Copy แล้ววางใน n8n จะได้ 3 nodes พร้อม connections
เลือก Trigger Rule: เช่น ทุกวันเวลา 9:00 น.
| Operation | Read Rows |
| Document | เลือก Spreadsheet ของคุณ |
| Sheet | เลือก Sheet ที่มีข้อมูล |
| name | position | photo_url | |
|---|---|---|---|
| สมชาย ใจดี | ผู้จัดการ | https://... | somchai@email.com |
| สมหญิง รักงาน | เลขานุการ | https://... | somying@email.com |
| Method | GET |
| URL | https://api.mpkbm.com/api/generate/YOUR_TEMPLATE_ID |
ใช้ URL จาก response: {{ $json.data.url }}
รับข้อมูลจากระบบอื่นแล้วสร้างรูปทันที
Copy แล้ววางใน n8n จะได้ Webhook + HTTP Request พร้อมเชื่อมต่อ
| HTTP Method | POST |
| Path | generate-card |
| Response Mode | Last Node |
| Response Code | 200 |
| Response Body | {{ $json }} |
สร้างบอทที่รับข้อมูลแล้วส่งรูปกลับทันที
| Credential | เชื่อมต่อ Bot Token |
| Updates | Message |
| Operation | Send Photo |
| Chat ID | {{ $('Telegram Trigger').item.json.message.chat.id }} |
| Photo | {{ $json.data.url }} |
จัดการ templates ผ่าน API
จัดการ assets (รูปภาพ, fonts) ผ่าน API