Skip to main content

Track Send Tasks with Subscriptions

send and related flows return a task ID and continue asynchronously.

For production real-time UX, prefer subscriptions over polling task.

For the general event schema, see Subscription Event Format.

Feed and Category

Task events are delivered on:

  • subscribeGroupFeed

They use:

  • category: "task"

Task Event Names

Current task workflow events include:

  • taskDocumentCreated
  • taskCompleted
  • taskStoppedByRecipientStopList
  • taskTrialCreditBlocked
  • taskCreditBlocked

Task Event Payload

Task payloads use this base shape:

{
"version": "1.0",
"eventId": "evt...",
"timestamp": "2026-04-24T10:38:36.822Z",
"level": "INFO",
"event": "taskCompleted",
"category": "task",
"groupId": "grp...",
"userId": "usr...",
"requestId": null,
"batchId": "bch...",
"error": null,
"data": {
"id": "tsk...",
"code": "TSKPROCESSOK",
"documents": []
}
}

Subscription Operation

subscription SubscribeGroupFeed($groupId: String!) {
subscribeGroupFeed(groupId: $groupId) {
groupId
data
}
}

JavaScript Example

const parseEnvelope = (payload) => {
const raw = payload?.data;
if (!raw) return null;
return typeof raw === 'string' ? JSON.parse(raw) : raw;
};

const handleGroupFeed = ({ data }) => {
const wrapper = data?.subscribeGroupFeed;
const event = parseEnvelope(wrapper);

if (event?.category !== 'task') return;

switch (event.event) {
case 'taskCompleted':
console.log('send task completed', event.data.id);
break;
case 'taskDocumentCreated':
console.log('document created inside task', event.data.documents);
break;
case 'taskCreditBlocked':
case 'taskTrialCreditBlocked':
case 'taskStoppedByRecipientStopList':
console.warn('task blocked', event.event, event.data.code);
break;
default:
console.log('task update', event.event, event.data);
}
};

Polling vs Subscriptions

Polling the task query is fine for:

  • getting started
  • simple scripts
  • debugging

Subscriptions are better when you want:

  • immediate UI updates
  • send progress reflected live in a dashboard
  • workflow notifications without repeated polling

Export This Article

Save a copy of this page as PDF or plain text.