IM
EN
Docs Home
Menu
Guides

Tasks And Manual Triggering

Create explicit task records and trigger associated queue work.

inbox-manager client-flow

Tasks And Manual Triggering

Purpose: create explicit task records and trigger associated queue work.

UI Flow

  1. User defines a task payload and priority.
  2. UI calls POST /api/accounts/:account_id/tasks.
  3. UI shows task timeline from /api/accounts/:account_id/tasks.
  4. User can trigger task with POST /api/tasks/:task_id/trigger.
  5. UI links task to jobs list filtered by task_id.

Client Library Flow

const task = await api.tasks.create(accountId, {
  task_type: "imap_sync_messages",
  target_credential_id: imapCredentialId,
  payload: { folder: "INBOX" },
  priority: 0,
});
await api.tasks.trigger(task.data.id);
const refreshed = await api.tasks.get(task.data.id);

HTTP/curl Flow

API_BASE_URL="https://api.inbox-manager.com"

curl -sS -X POST "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/tasks" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data '{
    "task_type":"imap_sync_messages",
    "target_credential_id":"'"${IMAP_CREDENTIAL_ID}"'",
    "payload":{"folder":"INBOX"},
    "priority":0
  }'

curl -sS -X POST "${API_BASE_URL}/api/tasks/${TASK_ID}/trigger" \
  -H "authorization: Bearer ${BEARER_TOKEN}" \
  -H "content-type: application/json" \
  --data '{}'

curl -sS "${API_BASE_URL}/api/accounts/${ACCOUNT_ID}/tasks?limit=20&offset=0" \
  -H "authorization: Bearer ${BEARER_TOKEN}"

Notes

  • Provider action routes are still the primary client path for IMAP/SMTP operations.
  • Generic tasks are useful for explicit queue workflows and ops tooling.