Leum gu prìomh susbaint

Trachd Beatha-dhùbhlain Sgrìobhainn is Neach-fhuaimre le Fo-sgrìobhadh

Cleachd fo-sgrìobhaidhean GraphQL airson ùrachaidhean beatha-dhùbhlain ann an àm fìor leithid:

  • cruthachadh sgrìobhainn
  • cruthachadh PDF deireannach
  • diùltadh sgrìobhainn
  • post-d neach-fhuaimre air a chuir
  • tadhal neach-fhuaimre
  • crìochnachadh neach-fhuaimre
  • diùltadh neach-fhuaimre
  • a’ fosgladh post-d neach-fhuaimre

Airson sgrìobhadh coitcheann a’ phacaid, faic:

Sruthan is Roinn-seòrsaichean

Mar as trice thig tachartasan beatha-dhùbhlain air:

  • subscribeGroupFeed

Dh’ fhaodadh cuid de thachartasan beatha-dhùbhlain cuideachd a bhith air an sgaoileadh gu:

  • subscribeUserFeed

Roinn-seòrsaichean:

  • documentLifecycle
  • recipientLifecycle

Ainmean Tachartais

Beatha-dhùbhlain sgrìobhainn

  • documentCreated
  • documentFinalPdfCreated
  • documentRejected

Beatha-dhùbhlain neach-fhuaimre

  • recipientSentEmail
  • recipientVisiting
  • recipientCompleted
  • recipientRejected
  • recipientEmailOpened

Cruthan Pacaid

Beatha-dhùbhlain sgrìobhainn

{
"version": "1.0",
"eventId": "evt...",
"timestamp": "2026-04-24T10:38:36.822Z",
"level": "INFO",
"event": "documentCreated",
"category": "documentLifecycle",
"groupId": "grp...",
"userId": "usr...",
"requestId": null,
"batchId": null,
"error": null,
"data": {
"id": "doc...",
"documentName": "Example document"
}
}

Beatha-dhùbhlain neach-fhuaimre

{
"version": "1.0",
"eventId": "evt...",
"timestamp": "2026-04-24T10:38:36.822Z",
"level": "INFO",
"event": "recipientVisiting",
"category": "recipientLifecycle",
"groupId": "grp...",
"userId": "usr...",
"requestId": null,
"batchId": null,
"error": null,
"data": {
"id": "rec...",
"documentId": "doc...",
"documentName": "Example document",
"firstName": "Ada",
"lastName": "Lovelace"
}
}

Gnìomh Fo-sgrìobhaidh

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

Eisimpleir JavaScript

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 === 'documentLifecycle') {
switch (event.event) {
case 'documentCreated':
case 'documentFinalPdfCreated':
case 'documentRejected':
console.log('document lifecycle event', event.event, event.data.id);
break;
default:
break;
}
}

if (event?.category === 'recipientLifecycle') {
switch (event.event) {
case 'recipientSentEmail':
case 'recipientVisiting':
case 'recipientCompleted':
case 'recipientRejected':
case 'recipientEmailOpened':
console.log('recipient lifecycle event', event.event, event.data.id);
break;
default:
break;
}
}
};

Cuin a chleachdas tu seo

Tha seo feumail nuair a tha thu airson:

  • liosta sgrìobhainn no sruth gnìomhachd ùrachadh ann an àm fìor
  • tachartasan com-pàirteachaidh neach-fhuaimre a nochdadh gun pholladh
  • freagairt sa bhad nuair a tha PDF deireannach deiseil
  • adhartachadh fiosan sruth-obrach ann am bàrdachd