Overview
This workflow uses a Manual Trigger so users can generate a PDF on demand for any selected record. A Logic Function handles:- Downloading the PDF from a URL (from a PDF generation service)
- Uploading the file to Twenty
- Creating an Attachment linked to the record
Prerequisites
Before setting up the workflow:- Create an API Key: Go to Settings → APIs and create a new API key. You’ll need this token for the Logic Function.
- Set up a PDF generation service (optional): If you want to dynamically generate PDFs (e.g., quotes), use a service like Carbone, PDFMonkey, or DocuSeal to create the PDF and get a download URL.
Step-by-Step Setup
Step 1: Configure the Trigger
- Go to Workflows and create a new workflow
- Select Manual Trigger
- Choose the object you want to attach PDFs to (e.g., Company or Opportunity)
Step 2: Add a Logic Function
- Add a Code action (Logic Function)
- Create a new function with the code below
- Configure the input parameters
Input Parameters
If attaching to a different object (Person, Opportunity, etc.), rename the parameter accordingly (e.g.,
personId, opportunityId) and update the logic function.Logic Function Code
Step 3: Customize for Your Use Case
To attach to a different object
ReplacetargetCompanyId with the appropriate field:
Update both the function parameter and the
variables.data object in the attachment mutation.
To use a dynamic PDF URL
If using a PDF generation service, you can:- First make an HTTP Request action to generate the PDF
- Pass the returned PDF URL to the logic function as a parameter
Step 4: Test and Activate
- Save the workflow
- Navigate to a Company record
- Click the ⋮ menu and select your workflow
- Check the Attachments section on the record to verify the PDF was attached
- Activate the workflow
Combining with PDF Generation Services
For creating dynamic quotes or invoices:Example: Generate Quote → Attach PDF
Popular PDF Generation Services
- Carbone - Template-based document generation
- PDFMonkey - Dynamic PDF creation from templates
- DocuSeal - Document automation platform
- Documint - API-first document generation