Generating your first Document with n8n
Ready to generate your first document with n8n and PDFMonkey? Learn to create your first document effortlessly with PDFMonkey's step-by-step guide.
What is n8n?
n8n is a powerful workflow automation platform that allows you to connect different apps and services together. It's an open-source alternative to tools like Zapier, offering both cloud and self-hosted options.
Prerequisites
Before we start, you'll need:
A PDFMonkey account (sign up here)
An n8n account or instance (sign up at n8n.io or self-host)
Your PDFMonkey API key
Create an account on PDFMonkey
To create an account, go to the Register page and fill in you email and password.
Once you've filled in your credentials, we will send you an activation email. Click the link in the email to activate your account. You will not be able to sign in until your account is confirmed.
Sign in
Once your account confirmed, fill in your credentials in the Sign in page to get access to your dashboard.
Create your first Template
To create a template, head to the Templates page and click on Create my first Template.
Give a name to your template, select the Code edition mode and select the Base Template named Blank.
It will open the Template Editor, where PDFMonkey's magic happens.
Writing your first Template
In the HTML tab, insert the following code:
<p class="greeting">Hello {{name}}!</p>
<p>Your favorite number is {{favoriteNumber}}.</p>
In the CSS tab, insert the following code:
.greeting {
color: #6D28D9;
font-size: 24px;
}
And finally in the Test data tab, insert this:
{
"name": "Peter Parker",
"favoriteNumber": 8
}
You can now click on the Save button, and you should see the preview panel on the right update to reflect your changes.
The last step is to make your Template available for generation. To do so, click on the Publish button.
Always publish your template!
Forgetting to publish your template is a frequent mistake, especially when switching back and forth between n8n and PDFMonkey. If the documents you generate don't match your template, always check you published it.
Setting up PDFMonkey credentials in n8n
Before using the PDFMonkey node, you need to configure your API credentials:
In your n8n workflow, add a PDFMonkey node
Click on Create New Credentials
Enter your PDFMonkey API key (found in your PDFMonkey dashboard)
Click Save
Where to find your API key
Your API key is available in your PDFMonkey dashboard under Account → API.
Creating your first workflow
Let's create a simple workflow that generates a PDF when triggered manually.
Step 1: Add a Manual Trigger
Create a new workflow in n8n
The Manual Trigger node should already be there
This will allow you to test your workflow manually
Step 2: Add the PDFMonkey node
Click the + button to add a new node
Search for PDFMonkey
Select the PDFMonkey node
Choose Generate Document as the operation
Step 3: Configure the Generate Document operation
In the PDFMonkey node configuration:
Select your PDFMonkey credentials (or create them if you haven't)
Set your Template ID from your PDFMonkey Template
Set the Payload Input Method to Key-Value Pairs
Add the following fields:
Key:
name
→ Value:Peter Parker
Key:
favoriteNumber
→ Value:8
Step 4: Test your workflow
Click on Execute Workflow (the play button at the bottom)
Wait a few seconds for the PDF to generate
You should see the document details in the output
The PDF is now available at the
download_url
provided
Step 5: Download the PDF (optional)
If you want to download the PDF file as binary data in n8n:
Enable Download File in the PDFMonkey node options
The PDF will be available as binary data in the next nodes
Example: Form to PDF via Email
Let's create a more practical workflow that:
Receives data from a webhook
Generates a PDF with PDFMonkey
Sends the PDF by email
The workflow structure
Webhook node - receives form data
PDFMonkey node - generates the document
Send Email node - sends the PDF as attachment
Configuration
Webhook node:
Set to POST method
Path:
/generate-pdf
PDFMonkey node:
Operation: Generate Document
Select your template
Map webhook data to template variables:
name
→{{ $json.name }}
favoriteNumber
→{{ $json.favoriteNumber }}
Enable Download File option
Send Email node:
Use Gmail, SendGrid, or any SMTP service
In attachments, reference the PDFMonkey binary data:
Property Name:
data
File Name:
document.pdf
Testing webhooks
Use the Test URL provided by n8n to send POST requests with JSON data like:
{
"name": "John Doe",
"favoriteNumber": 42
}
Congrats!
You've successfully generated your first PDFMonkey Document using n8n! 🎉
Want to know more?
To learn more about the different options you can use when using PDFMonkey with n8n, head to our more thorough documentation on the integration.
Document generation options in n8nReacting to generated documents in n8nRelated articles
What can you do with PDFMonkey?Last updated
Was this helpful?