{"name":"Prooftask · events","nodes":[{"id":"pt-continuity-0","name":"Project event","type":"n8n-nodes-base.webhook","typeVersion":2,"position":[0,0],"parameters":{"httpMethod":"POST","path":"prooftask-project-event","responseMode":"lastNode","options":{"rawBody":true}},"notes":"Use this HTTPS production webhook URL when authorizing a subscription. Keep the workflow inactive until configured. A success response follows verification and authorized readback.","notesInFlow":true},{"id":"pt-continuity-1","name":"Exact signed bytes","type":"n8n-nodes-base.code","typeVersion":2,"position":[260,0],"parameters":{"jsCode":"const i=$input.first(); const raw=await this.helpers.getBinaryDataBuffer(0,'data'); if(raw.length>8192)throw new Error('EVENT_TOO_LARGE'); return [{json:{subscriptionId:'REPLACE_SUBSCRIPTION_ID',rawBody:raw.toString('utf8'),timestamp:i.json.headers['prooftask-timestamp'],signature:i.json.headers['prooftask-signature']}}];"}},{"id":"pt-continuity-2","name":"Verify event","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[520,0],"parameters":{"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","options":{"allowUnauthorizedCerts":false,"redirect":{"redirect":{"followRedirects":false,"maxRedirects":0}},"response":{"response":{"responseFormat":"json","neverError":false}},"timeout":20000},"method":"POST","url":"={{ 'https://prooftask.com/api/agents/v1/webhooks/' + encodeURIComponent($json.subscriptionId) + '/verify' }}","sendBody":true,"contentType":"json","specifyBody":"json","jsonBody":"={{ JSON.stringify({rawBody:$json.rawBody,timestamp:$json.timestamp,signature:$json.signature}) }}"},"notes":"The same scoped agent must own this subscription. Verification fails closed on forged, expired or revoked events.","notesInFlow":true},{"id":"pt-continuity-3","name":"Read saved job results","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[780,0],"parameters":{"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","options":{"allowUnauthorizedCerts":false,"redirect":{"redirect":{"followRedirects":false,"maxRedirects":0}},"response":{"response":{"responseFormat":"json","neverError":false}},"timeout":20000},"method":"GET","url":"={{ 'https://prooftask.com/api/agents/v1/jobs?projectId=' + encodeURIComponent($json.event.projectId) }}"}},{"id":"pt-continuity-4","name":"Return to original workflow","type":"n8n-nodes-base.code","typeVersion":2,"position":[1040,0],"parameters":{"jsCode":"const event=$('Verify event').first().json.event;return $input.all().map(i=>({json:{eventId:event.id,eventSequence:event.sequence,...i.json}}));"},"notes":"Connect your existing update node here. Upsert by workflowReference/job ID; retain eventId and highest sequence. Only decisionForSavedSubmission refers to that job. An older or duplicate event never proves a new delivery was accepted.","notesInFlow":true}],"connections":{"Project event":{"main":[[{"node":"Exact signed bytes","type":"main","index":0}]]},"Exact signed bytes":{"main":[[{"node":"Verify event","type":"main","index":0}]]},"Verify event":{"main":[[{"node":"Read saved job results","type":"main","index":0}]]},"Read saved job results":{"main":[[{"node":"Return to original workflow","type":"main","index":0}]]}},"active":false,"settings":{"executionOrder":"v1","saveDataSuccessExecution":"none","saveDataErrorExecution":"none","saveManualExecutions":false},"pinData":{},"tags":[]}