Social — Register#
Giai đoạn đầu tiên: Đăng ký tài khoản trên các site social được chỉ định (schema entity-style: first_name/last_name/phone/address/avatar).
Base URL: https://manager.likepion.com/api/v1/social_account
1. Lấy danh sách task #
curl -X GET 'https://manager.likepion.com/api/v1/social_account/links?limit=5&status=register' \
-H 'X-API-Key: <api_key>'| Param | Mặc định | Mô tả |
|---|---|---|
limit | 5 | Số task muốn pull (tối đa 1000) |
status | — | Lọc theo trạng thái task (register) |
Response#
{
"success": true,
"data": [
{
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"request_id": "f0e1d2c3-b4a5-6789-0abc-def123456789",
"domain": "example-social.com",
"website": "https://likepion.com",
"email": "socuser@gmail.com",
"username": "socuser01",
"pass_mail": "xxxx xxxx xxxx xxxx",
"twofa": "JBSWY3DPEHPK3PXP",
"app_password": "xxxx xxxx xxxx xxxx",
"password": "Abc123!@xyzQ",
"first_name": "Minh",
"last_name": "Ngoc",
"phone": "0987654321",
"address": "123 ABC",
"location": "HCM",
"about": "<p>Bio HTML with {spin|syntax}</p>",
"avatar_url": "https://s3.likepion.com/avatars/abc.jpg",
"cover_url": "https://s3.likepion.com/covers/xyz.jpg",
"social_connect": [
"https://twitter.com/seouser01",
"https://facebook.com/seouser01",
"https://linkedin.com/in/seouser01",
"https://youtube.com/@seouser01"
]
}
]
}Giải thích fields#
| Field | Mô tả |
|---|---|
id | ID task — dùng khi gọi start/complete/fail |
request_id | ID request cha |
domain | Site social target |
website | Website khách hàng |
email / username | Email / username register |
pass_mail / twofa / app_password | Credentials Gmail + TOTP + app password |
password | Mật khẩu tạo sẵn |
first_name, last_name | Họ tên profile |
phone, address, location | Thông tin liên hệ |
about | Bio/Mô tả (đã xử lý spin) |
avatar_url, cover_url | S3 URL ảnh |
social_connect | Danh sách link social cần gắn (Array of strings) |
images | Danh sách ảnh (dạng array gom nhóm avatar/cover) |
2. Lấy chi tiết task #
Lấy thông tin 1 task cụ thể theo id. Bắt buộc gửi status để Assign verify task đang đúng phase mày mong đợi (tránh worker xử lý nhầm task đã chuyển status). Không thay đổi DB.
curl -X GET 'https://manager.likepion.com/api/v1/social_account/links/TASK_ID?status=register' \
-H 'X-API-Key: <api_key>'| Param | Bắt buộc | Mô tả |
|---|---|---|
status | ✔ | Trạng thái mong đợi của task (register | registering). Nếu task đang ở status khác → HTTP 409. |
Response#
Trả về 1 object (không bọc trong mảng) — schema giống bước 1.
{ "success": true, "data": { ...task fields... } }| Lỗi | Mã | Mô tả |
|---|---|---|
task not found | 404 | Task không tồn tại hoặc đã soft-delete |
status mismatch | 409 | Task đang ở status khác với status truyền vào |
3. Báo đang xử lý #
Sau khi pull task, bắt buộc gọi API này để chuyển task từ register → registering.
| Trạng thái trước | Trạng thái sau |
|---|---|
register | registering |
curl -X POST 'https://manager.likepion.com/api/v1/social_account/links/<task_id>/start' \
-H 'X-API-Key: <api_key>'Response#
{ "success": true }4. Báo hoàn thành #
Báo đăng ký thành công — task chuyển từ registering → completed. Đây là bước cuối cùng (không có phase connect).
⚠️ Lưu ý: body Test mặc định chứa placeholder dạng
<...>. Phải thay placeholder bằng giá trị thực trước khi Send.✅ Server-side validation: Assign TỪ CHỐI 400 nếu body chứa giá trị mẫu (
<...>,example-social.com,socuser01,yourdomain,<URL_*>…). Worker sẽ thấy lỗi rõ ràngplaceholder rejected, không có cách nào lưu nhầm vào DB.
| Trạng thái trước | Trạng thái sau |
|---|---|
registering | completed |
curl -X POST 'https://manager.likepion.com/api/v1/social_account/links/<task_id>/complete' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"email": "<EMAIL_THỰC_VỪA_TẠO>",
"username": "<USERNAME>",
"password": "<PASSWORD>",
"cookie": "<COOKIE_NẾU_CÓ>",
"link_profile": "<URL_PROFILE_TRÊN_SITE>",
"note": "Account + profile updated"
}'| Field | Bắt buộc | Mô tả |
|---|---|---|
email / username / password / cookie | ✔ | Ít nhất 1 field credentials thực để lưu account vào pool |
link_profile | URL profile account trên site (ví dụ https://deviantart.com/u/username). Assign lưu vào social_account.link_profile để phase post sau này reference. | |
note | Ghi chú (tuỳ chọn) |
Response#
{ "success": true }5. Báo thất bại #
Social account không có retry — fail là terminal. Worker gửi status để phân biệt:
| Trạng thái trước | Trạng thái sau | Khi nào dùng |
|---|---|---|
registering | final_failed (mặc định) | Account chưa tạo được (email exists, captcha, site down…) — không retry |
registering | active (gửi status: "profile_failed") | Account đã tạo xong, chỉ lỗi update profile → coi như thành công, account vẫn usable cho phase post |
curl -X POST 'https://manager.likepion.com/api/v1/social_account/links/<task_id>/fail' \
-H 'X-API-Key: <api_key>' \
-H 'Content-Type: application/json' \
-d '{
"status": "profile_failed",
"link_profile": "https://deviantart.com/u/username",
"error_message": "Avatar upload rejected"
}'| Field | Bắt buộc | Mô tả |
|---|---|---|
error_message | ✔ | Mô tả ngắn lỗi (≤1000 ký tự) |
status | register_failed | profile_failed (default) | |
link_profile | URL profile (nếu account đã tạo được dù profile fail) | |
note | Ghi chú |
Response#
{ "success": true }