กล่องจดหมายและข้อความซิงค์ IMAP
วัตถุประสงค์: จัดคิวงานการซิงค์ IMAP และคงข้อมูลเมตาของข้อความสำหรับการค้นหาและการอ่านโฟลว์
โฟลว์ UI
- ผู้ใช้เลือกข้อมูลประจำตัวและโฟลเดอร์
- UI จัดคิวการซิงค์กล่องจดหมายหรือการซิงค์ข้อความ
- UI สำรวจงาน/งานสำหรับสถานะเทอร์มินัล
- UI รีเฟรช
/api/accounts/:account_id/emails
โฟลว์ไลบรารีไคลเอนต์
const mailboxTask = await api.provider.imap.syncMailboxes(accountId, {
credential_id: imapCredentialId,
});
const messageTask = await api.provider.imap.syncMessages(accountId, {
credential_id: imapCredentialId,
folder: "INBOX",
});
await api.jobs.waitForTask(accountId, messageTask.data.task_id);
const emails = await api.emails.list(accountId, { limit: 20, offset: 0 });
HTTP/ขดไหล
API_BASE_URL="https://api.inbox-manager.com"
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/imap/sync-mailboxes" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"credential_id\":\"${IMAP_CREDENTIAL_ID}\"}"
curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/imap/sync-messages" \
-H "authorization: Bearer ${BEARER_TOKEN}" \
-H "content-type: application/json" \
--data "{\"credential_id\":\"${IMAP_CREDENTIAL_ID}\",\"folder\":\"INBOX\"}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/jobs?limit=20" \
-H "authorization: Bearer ${BEARER_TOKEN}"
curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/emails?limit=20&offset=0" \
-H "authorization: Bearer ${BEARER_TOKEN}"
สคริปต์การตรวจสอบ
scripts/provider_job_flow.sh