Skip to main content

การกำหนดค่าสคริปต์ Post

หน้านี้บันทึกพารามิเตอร์การกำหนดค่าสำหรับสคริปต์ post ที่ใช้ในการสร้างงาน

ภาพรวม

สคริปต์ post ใช้สำหรับเผยแพร่เนื้อหา (วิดีโอหรือรูปภาพ) ไปยัง TikTok หรือ Instagram โดยอัตโนมัติ รองรับวิธีการโพสต์หลากหลาย แหล่งที่มาของวัสดุ และตัวเลือกเสียง

พารามิเตอร์คำขอ

เมื่อสร้างงาน คุณสามารถระบุพารามิเตอร์ระดับบนสุดต่อไปนี้:

พารามิเตอร์ประเภทจำเป็นค่าเริ่มต้นคำอธิบาย
serialsstring[]มีเงื่อนไข[]รายการหมายเลขซีเรียลอุปกรณ์ (โหมด 1: ตามอุปกรณ์)
usernamesstring[]มีเงื่อนไข[]รายการชื่อผู้ใช้เพื่อสร้างงาน (โหมด 2: ตามชื่อผู้ใช้)
script_namestringใช่-ชื่อสคริปต์ที่จะรันเนื้อหา (เช่น "post")
script_configobjectใช่-พารามิเตอร์การกำหนดค่าสคริปต์ (ดูด้านล่าง)
enable_multi_accountbooleanไม่falseเปิดใช้งานโหมดหลายบัญชี (สร้างงานสำหรับแต่ละบัญชีในอุปกรณ์)
start_timestringไม่-เวลาเริ่มต้นเสริม ในรูปแบบ "HH:MM"
platformstringมีเงื่อนไข*autoแพลตฟอร์มเป้าหมาย: tiktok, instagram. ดูหมายเหตุด้านล่าง

หมายเหตุ: ต้องระบุ serials หรือ usernames อย่างใดอย่างหนึ่ง

*พฤติกรรมพารามิเตอร์ Platform:

  • TikMatrix และ IgMatrix: พารามิเตอร์ platform จะถูกละเว้นหากมีการระบุ แพลตฟอร์มจะถูกกำหนดโดยอัตโนมัติจากชื่อแอป (TikMatrix → tiktok, IgMatrix → instagram)
  • TikMatrix Pro: พารามิเตอร์ platform เป็นสิ่งจำเป็นและต้องระบุอย่างชัดเจนเป็น tiktok หรือ instagram

การกำหนดค่าสคริปต์ (script_config)

วัตถุ script_config มีพารามิเตอร์สำหรับสคริปต์ post ด้านล่างเป็นพารามิเตอร์ที่มีอยู่:

พารามิเตอร์ทั่วไป (TikTok และ Instagram)

พารามิเตอร์ประเภทจำเป็นค่าเริ่มต้นคำอธิบาย
content_typeintegerไม่0ประเภทเนื้อหา: 0 = วิดีโอ, 1 = รูปภาพ
image_countintegerไม่1จำนวนรูปภาพที่จะเลือก (เมื่อ content_type = 1)
captionsstringไม่""ข้อความคำบรรยายโพสต์ รองรับรูปแบบ spintax: {ตัวเลือก1|ตัวเลือก2|ตัวเลือก3}
post_waystringไม่"share"วิธีการโพสต์: share, addButton หรือ useSound
material_sourcestringไม่"materialLibrary"แหล่งที่มาของวัสดุ: materialLibrary หรือ localFolder (ถูกละเว้นถ้ามี material_list)
material_pathstringมีเงื่อนไข""เส้นทางโฟลเดอร์ภายในเครื่อง (จำเป็นเมื่อ material_source = "localFolder")
material_liststring[]ไม่[]อาร์เรย์เส้นทางไฟล์วัสดุโดยตรง เมื่อระบุจะข้าม logic ของ material_source และ material_path เหมาะสำหรับระบบอัตโนมัติ API
materials_tagsstringไม่""แท็กวัสดุที่คั่นด้วยจุลภาคสำหรับกรองจากคลัง
upload_wait_timeintegerไม่30วินาทีในการรอการอัปโหลดเสร็จสิ้น
sound_wait_timeintegerไม่10วินาทีในการรอการโหลดเสียง
add_soundstring/integerไม่"-1"ตัวเลือกเสียง: -1 = เริ่มต้น, 0 = ปิด, 1 = เปิด, custom = ใช้เสียงกำหนดเอง
sound_namestringมีเงื่อนไข""ชื่อเสียง/URL (จำเป็นเมื่อ post_way = "useSound")
custom_sound_keywordstringมีเงื่อนไข""คำค้นหาเสียงกำหนดเอง (จำเป็นเมื่อ add_sound = "custom")
origin_sound_volumeintegerไม่50ระดับเสียงต้นฉบับ (0-100)
add_sound_volumeintegerไม่50ระดับเสียงที่เพิ่ม (0-100)

พารามิเตอร์เฉพาะ TikTok

พารามิเตอร์ประเภทจำเป็นค่าเริ่มต้นคำอธิบาย
add_product_linkintegerไม่0เพิ่มลิงก์สินค้า: 0 = ไม่, 1 = ใช่

พารามิเตอร์เฉพาะ Instagram

พารามิเตอร์ประเภทจำเป็นค่าเริ่มต้นคำอธิบาย
placementstringไม่"reel"ตำแหน่งโพสต์: reel หรือ story

ตัวอย่าง

งานโพสต์พื้นฐานพร้อมรายการวัสดุโดยตรง

นี่เป็นวิธีที่แนะนำสำหรับระบบอัตโนมัติ API - ส่งเส้นทางวัสดุโดยตรงโดยไม่ต้องพึ่งคลังวัสดุหรือการสแกนโฟลเดอร์:

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "ชมวิดีโอใหม่ของฉัน! #viral #fyp",
"material_list": [
"C:/Videos/video1.mp4"
],
"upload_wait_time": 60
}
}'

งานโพสต์พร้อมคลังวัสดุ (TikTok)

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1", "device_serial_2"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "ชมวิดีโอใหม่ของฉัน! #viral #fyp",
"post_way": "addButton",
"material_source": "materialLibrary",
"materials_tags": "trending, dance",
"upload_wait_time": 60,
"add_sound": "-1"
},
"enable_multi_account": false
}'

งานโพสต์ตามรายการชื่อผู้ใช้

โหมดนี้ช่วยให้คุณสร้างงานสำหรับบัญชีเฉพาะได้โดยตรงโดยไม่ต้องรู้หมายเลขซีเรียลอุปกรณ์:

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"usernames": ["@user1", "@user2", "@user3"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "ชมวิดีโอใหม่ของฉัน! #viral #fyp",
"material_list": [
"C:/Videos/video1.mp4"
],
"upload_wait_time": 60
}
}'

งานโพสต์พร้อมโฟลเดอร์ภายในเครื่อง (Instagram)

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "เนื้อหาที่น่าทึ่ง! #instagram #reels",
"post_way": "addButton",
"placement": "reel",
"material_source": "localFolder",
"material_path": "C:/Videos/instagram",
"upload_wait_time": 45
},
"enable_multi_account": true
}'

โพสต์พร้อมเสียงกำหนดเอง

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"content_type": 0,
"captions": "เต้นตามเสียงยอดนิยมนี้!",
"post_way": "addButton",
"add_sound": "custom",
"custom_sound_keyword": "trending dance 2024",
"origin_sound_volume": 30,
"add_sound_volume": 70,
"material_source": "materialLibrary",
"upload_wait_time": 60
}
}'

โพสต์โดยใช้ URL เสียงที่ระบุ

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"post_way": "useSound",
"sound_name": "https://www.tiktok.com/music/original-sound-7123456789",
"captions": "ใช้เสียงที่ยอดเยี่ยมนี้!",
"material_source": "materialLibrary"
}
}'
curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"script_config": {
"content_type": 1,
"image_count": 5,
"captions": "ชมภาพเหล่านี้! #photocarousel",
"material_source": "localFolder",
"material_path": "C:/Images/carousel",
"upload_wait_time": 45
}
}'

โพสต์พร้อมการเลือกแพลตฟอร์มโดยชัดเจน

คุณสามารถระบุแพลตฟอร์มเป้าหมายได้อย่างชัดเจนโดยใช้พารามิเตอร์ platform มีประโยชน์เมื่อคุณต้องการแทนที่ค่าเริ่มต้นของสภาพแวดล้อม:

curl -X POST http://localhost:50809/api/v1/task \
-H "Content-Type: application/json" \
-d '{
"serials": ["device_serial_1"],
"script_name": "post",
"platform": "instagram",
"script_config": {
"content_type": 0,
"captions": "กำลังโพสต์ไปยัง Instagram! #instagram #reels",
"placement": "reel",
"material_list": [
"C:/Videos/instagram_video.mp4"
],
"upload_wait_time": 60
}
}'

การตอบกลับ

{
"code": 0,
"message": "success",
"data": {
"task_ids": [101, 102],
"created_count": 2
}
}

ดูเพิ่มเติม