Reacting to generated documents in n8n
PDFMonkey can notify your n8n workflows whenever a document is generated. This is perfect for automating actions after PDF generation, like storing files, sending notifications, or updating databases.
What is the PDFMonkey Trigger?
The PDFMonkey Trigger is a webhook-based trigger that listens for document generation events from PDFMonkey. When a document is successfully generated, PDFMonkey sends a notification to your n8n workflow.
Setting up the trigger
Step 1: Add the PDFMonkey Trigger node
In your n8n workflow, click + to add a new node
Search for PDFMonkey Trigger
Select it as your workflow's starting point
Step 2: Configure your credentials
Select your PDFMonkey API credentials (the same ones used for the regular PDFMonkey node).
Step 3: Choose which templates to listen to
You have three options:
Any Template - Trigger for all documents generated in your workspace
Specific Template - Trigger only for a single template
Multiple Templates - Trigger for several selected templates

Step 4: Configure the webhook in PDFMonkey
The trigger node will display a Webhook URL. You need to add this URL to your PDFMonkey template:
Copy the webhook URL from the n8n trigger node
Go to your PDFMonkey dashboard
Navigate to the Webhooks section
Create a new endpoint
Add the n8n webhook URL
Check the events success and failure
Press the Create button
Step 5: Activate your workflow
Click the Activate toggle in the top-right corner of n8n to enable your workflow.
What data is provided by the trigger?
When a document is generated, the trigger provides:
{
"id": "doc_abc123",
"status": "success",
"filename": "invoice-2024.pdf",
"download_url": "https://...",
"preview_url": "https://...",
"template_id": "tmpl_xyz789",
"metadata": {
"orderId": "12345",
"customField": "value"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:05Z"
}
Payload data is not included
The webhook does not include the original payload data you sent to generate the document. If you need this information in your workflow, use metadata to store it.
Auto-download feature
The PDFMonkey Trigger has a useful Download File option that automatically downloads the PDF when the trigger fires.
When enabled:
The PDF is downloaded as binary data
Available immediately in the next nodes
No need for a separate Download File operation
To enable it:
Open the trigger node settings
Expand Additional Options
Toggle Download File to ON
The binary data will be available with the key data
.
Use cases
Example 1: Store PDFs in Google Drive
1. PDFMonkey Trigger (Download File: enabled)
2. Google Drive - Upload File
- File: {{ $binary.data }}
- Folder: /Invoices/
- Filename: {{ $json.filename }}
Example 2: Send notification to Slack
1. PDFMonkey Trigger
2. Slack - Send Message
- Channel: #notifications
- Message: "New PDF generated: {{ $json.filename }}"
- Attachment: {{ $json.download_url }}
Example 3: Update database record
1. PDFMonkey Trigger
2. Postgres - Update
- Table: orders
- Where: id = {{ $json.metadata.orderId }}
- Set: pdf_url = {{ $json.download_url }}, status = 'completed'
Example 4: Email PDF to customer
1. PDFMonkey Trigger (Download File: enabled)
2. Gmail - Send Email
- To: {{ $json.metadata.customerEmail }}
- Subject: Your invoice is ready
- Attachments: {{ $binary.data }}
Using metadata for routing
Metadata is extremely useful for conditional workflows. Here's an example:
When generating the document:
{
"metadata": {
"documentType": "invoice",
"customerId": "12345",
"sendEmail": true
}
}
In your triggered workflow:
1. PDFMonkey Trigger
2. IF node
- Condition: {{ $json.metadata.sendEmail }} = true
- TRUE: Send email with PDF
- FALSE: Just store in database
Or route by document type:
1. PDFMonkey Trigger
2. Switch node
- Case 1: {{ $json.metadata.documentType }} = "invoice" → Store in accounting
- Case 2: {{ $json.metadata.documentType }} = "report" → Share on Slack
- Case 3: {{ $json.metadata.documentType }} = "contract" → Store in DocuSign
Testing your trigger
Method 1: Generate a test document
The easiest way to test is to generate a document:
Use another workflow or the API to generate a document
Wait for the webhook to fire
Check the trigger node execution in n8n
Method 2: Use the test webhook
Click Listen for event in the trigger node
Generate a document from your PDFMonkey template
The trigger will catch the event and display the data
Click Use test event to use this data while building your workflow
Pro tip: Use the PDFMonkey dashboard
You can manually trigger a test generation from your PDFMonkey template editor by clicking the Generate button. This will fire the webhook immediately.
Multiple triggers for the same template
You can have multiple n8n workflows listening to the same template. Each webhook will receive the notification independently.
This is useful for:
Separating production and staging environments
Having different workflows for different document types
A/B testing different automation strategies
Webhook delivery guarantees
PDFMonkey webhooks are delivered with:
At-least-once delivery: You might receive the same event multiple times
Best-effort ordering: Events are usually in order but not guaranteed
5-second timeout: The webhook request will timeout after 5 seconds
3 retry attempts: Failed webhooks are retried with exponential backoff
Troubleshooting
Webhook not firing
Check your workflow is activated - The workflow must be active, not just saved
Verify the webhook URL - Make sure the URL in PDFMonkey matches n8n's production URL
Check template is published - Unpublished templates don't send webhooks
Look at PDFMonkey webhook logs - Available in your template settings
Documents generated but trigger doesn't execute
Check n8n execution logs - Look for errors in the workflow executions
Verify credentials - Make sure your PDFMonkey credentials are valid
Check template filter - If filtering by template, ensure it's the right one
Binary data not available
Make sure Download File is enabled in the trigger node's additional options.
Related articles
Document generation options in n8nWebhooksLast updated
Was this helpful?