Skip to main content
View as Markdown

Automatically send the PDF report to Google Drive with n8n

With this recipe, every case closed in Certificall automatically uploads its signed PDF report to the Google Drive folder of your choice, through a four-node n8n workflow.

It produces the same result as the Zapier recipe, with three advantages: the webhook is protected by a secret checked on every call, the download and upload are retried automatically on failure, and you can host n8n yourself, in the European Union or in your own infrastructure. See Zapier or n8n?

Before you start

How it works, the common prerequisites (including case sharing), the webhook content and the common limitations are described in Automate without coding. Read it first.

n8n-specific prerequisites​

PrerequisiteDetails
An n8n instanceOn the n8n service, or self-hosted. It must be reachable from the internet over HTTPS, with a domain name.
A Google Drive accountAnd the folder in which to store the reports. It must exist before you configure the workflow.
A secretA long random value of your choice. It will be registered both in n8n and with Certificall.

Go faster: let the AI build the workflow​

n8n can build the workflow for you from a description. Copy this prompt, paste it into the workflow editor's AI assistant, then check the result. You can also import the ready-made workflow.

Prompt for the n8n AI assistant
Create a 4-node n8n workflow:

1. Webhook
   - Method: POST.
   - Path: certificall-case-closed.
   - Authentication: Header Auth. I will create the credential myself (Name: Authorization, Value: Bearer followed by my secret).
   - Respond: Immediately.

2. IF: continue only if both conditions are true (AND).
   - {{ $json.body.closed }}: Boolean, is true.
   - {{ $json.body.caseUrl }}: String, is not empty.
   Only the true output is connected to the next node.

3. HTTP Request, named "Download PDF"
   - Method: GET. URL: {{ $json.body.caseUrl }}. No authentication.
   - Response Format: File, in the binary field "data".
   - Settings: Retry On Fail, 3 tries, 5000 ms between tries.

4. Google Drive, operation "Upload file"
   - Input Data Field Name: data.
   - File Name: Certificall_{{ $('Webhook').item.json.body.cfRef }}.pdf
   - Settings: Retry On Fail, 3 tries.
   I will choose the Google account and the destination folder myself.

Do not put any secret or credential in the workflow.

Once the workflow is created, you still need to:

  1. Check each node against the settings described below: the AI may deviate slightly from the request.
  2. Create the Header Auth credential with your secret (node 1).
  3. Connect your Google account and choose the destination folder (node 4).
  4. Have the production URL and the secret registered with Certificall (node 1, item 4).
  5. Test, then activate the workflow.
No AI assistant in your version?

The availability of the AI assistant depends on your n8n plan and version. If you do not have access to it, import the workflow or follow the steps below.

Workflow overview​

Node 1 — Webhook: receive the closed case​

  1. Create a new workflow, then add a Webhook node.
  2. Configure it as follows:
SettingValue
HTTP MethodPOST
PathA path of your choice, for example certificall-case-closed
AuthenticationHeader Auth
RespondImmediately (immediate 200 response)
  1. For Header Auth, create a credential with:
FieldValue
NameAuthorization
ValueBearer <your-secret>
The word "Bearer" is part of the value

Type Bearer, a space, then your secret. This is the exact format of the header sent by Certificall. Without this prefix, n8n rejects every call.

  1. Have the webhook's production URL, of the form https://<your-n8n-instance>/webhook/certificall-case-closed, and your secret as the token registered with Certificall:
    • by your technical team, through the API: see Webhook configuration. The address goes in endpoint, the secret in authToken, without the word Bearer;
    • or by your Certificall contact, to whom you send the address and the secret through a secure channel.
Production URL, not test URL

n8n displays two addresses. The test URL (/webhook-test/…) only responds while the editor is listening for a call. Register the production URL (/webhook/…) with Certificall.

In n8n, the webhook content arrives under body: the case reference is written, for example, {{ $json.body.cfRef }}.

Node 2 — IF: only process usable cases​

Add an IF node, which only lets through closed cases that have a download link. Both conditions must be true (AND):

Value testedCondition
{{ $json.body.closed }}Boolean → is true
{{ $json.body.caseUrl }}String → is not empty

Only the true output is connected to the rest of the workflow.

Node 3 — HTTP Request: download the PDF report​

Add an HTTP Request node, which you can rename "Download PDF":

SettingValue
MethodGET
URL{{ $json.body.caseUrl }}
AuthenticationNone
Response Format (in Options → Response)File
Put Output in Fielddata

In the node's Settings tab, enable Retry On Fail, with 3 tries (Max Tries) and a 5,000 ms interval (Wait Between Tries).

Node 4 — Google Drive: upload the PDF​

Add a Google Drive node, with the Upload file operation, then connect your Google account:

SettingValue
Input Data Field Namedata
File NameCertificall_{{ $('Webhook').item.json.body.cfRef }}.pdf
Parent Drive and Parent FolderThe destination folder, which must already exist

In the node's Settings tab, enable Retry On Fail, with 3 tries.

Don't forget the .pdf extension

Type .pdf at the end of the file name. Without it, Google Drive does not open the file as a PDF.

The file name fetches cfRef from the Webhook node: at this point in the workflow, the current item is the downloaded PDF, no longer the webhook content.

Activate the workflow​

Close a test case to check that the PDF arrives in your Drive, then activate the workflow (Active toggle at the top of the editor).

Nothing happens until it is activated

As long as the workflow is not activated, the production URL does not respond, and the webhooks sent by Certificall are lost.

Optional: organize your reports better​

  • Name the file with your own reference: use {{ $('Webhook').item.json.body.reportId }} instead of or in addition to cfRef.
  • Include the template in the name: add {{ $('Webhook').item.json.body.frame }}, which contains the template name.

Import the workflow​

Instead of creating the nodes by hand, you can import this workflow into n8n in two ways:

  • By copy and paste: copy the JSON below, open an empty workflow, click on the canvas, then paste (Ctrl+V, or Cmd+V on a Mac). The four nodes appear.
  • From a file: save the JSON to a .json file, then, in an empty workflow, open the ⋯ menu at the top right of the editor and choose Import from File.

Then fill in the Header Auth and Google Drive credentials, and choose your destination folder.

{
"name": "Certificall - PDF report to Google Drive",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "certificall-case-closed",
"authentication": "headerAuth",
"responseMode": "onReceived",
"options": {}
},
"id": "webhook",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [0, 0],
"webhookId": "certificall-case-closed"
},
{
"parameters": {
"conditions": {
"options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
"conditions": [
{
"id": "closed-is-true",
"leftValue": "={{ $json.body.closed }}",
"rightValue": "",
"operator": { "type": "boolean", "operation": "true", "singleValue": true }
},
{
"id": "caseurl-not-empty",
"leftValue": "={{ $json.body.caseUrl }}",
"rightValue": "",
"operator": { "type": "string", "operation": "notEmpty", "singleValue": true }
}
],
"combinator": "and"
},
"options": {}
},
"id": "if",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [220, 0]
},
{
"parameters": {
"url": "={{ $json.body.caseUrl }}",
"options": {
"response": {
"response": { "responseFormat": "file", "outputPropertyName": "data" }
}
}
},
"id": "download-pdf",
"name": "Download PDF",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [440, -100],
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 5000
},
{
"parameters": {
"name": "=Certificall_{{ $('Webhook').item.json.body.cfRef }}.pdf",
"driveId": { "__rl": true, "mode": "list", "value": "My Drive" },
"folderId": { "__rl": true, "mode": "id", "value": "<your-drive-folder-id>" },
"inputDataFieldName": "data",
"options": {}
},
"id": "upload-file",
"name": "Upload file",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [660, -100],
"retryOnFail": true,
"maxTries": 3
}
],
"connections": {
"Webhook": { "main": [[{ "node": "IF", "type": "main", "index": 0 }]] },
"IF": { "main": [[{ "node": "Download PDF", "type": "main", "index": 0 }], []] },
"Download PDF": { "main": [[{ "node": "Upload file", "type": "main", "index": 0 }]] }
},
"settings": {}
}

n8n-specific limitations​

In addition to the common limitations:

LimitationDetails
No alert by defaultA failure is only visible in the n8n Executions tab. To be notified, configure an Error Workflow in the workflow settings (Settings → Error Workflow), for example to receive an email.
Retries do not recover a lost webhookRetries apply to the download and the upload to Drive. If n8n does not receive the webhook, for example because it is unavailable or the workflow is not activated, Certificall does not resend it.
Sharing link requiredAs with Zapier, the download is done without authentication: it requires sharing to be enabled for the case. See Case sharing.

Troubleshooting​

SymptomLikely causeWhat to do
Certificall receives a 401 or 403 error from the webhookThe Header Auth value does not match the header sentCheck that the value is exactly Bearer <your-secret>, with a space, and that the secret is the same as the one registered with Certificall.
Nothing happens when a case is closedThe workflow is not activated, or the URL registered with Certificall is the test URL (/webhook-test/…)Activate the workflow, and have the production URL (/webhook/…) registered.
The execution stops at the IF nodeThe caseUrl field is empty: sharing is not enabled for the caseContact your Certificall contact to enable case sharing.
The HTTP Request node fails with a 403 errorThe case cannot be shared, or its sharing has expiredCheck the case sharing with your Certificall contact.
The HTTP Request node fails with a 404 errorThe link is invalid or the report cannot be foundCheck that the node URL is exactly {{ $json.body.caseUrl }}, with no added text.
The file uploaded to Drive is unreadableThe .pdf extension is missing from the file nameAdd .pdf at the end of the Google Drive node's File Name.