# Workato Integration: Automate Documents


The PDFMonkey connector for [Workato](https://www.workato.com/) lets you generate, monitor, and clean up documents as part of your automated recipes. Combine it with triggers from CRMs, form builders, or databases to produce and deliver files without writing code.

## Setup {#setup}

Before you begin, make sure you have:

- A PDFMonkey account ([sign up here](https://dashboard.pdfmonkey.io/register))
- A [Workato](https://www.workato.com/) account
- A published template in PDFMonkey

For account creation and template setup, see [From Zero to First Document](../getting-started/from-zero-to-first-document.md).

To connect PDFMonkey to Workato:

1. Add the **PDFMonkey** connector to your recipe.
2. Create a new connection and enter your API Secret Key, available on the [My Account](https://dashboard.pdfmonkey.io/account) page.

Once connected, the PDFMonkey actions and triggers are available in your recipe steps.

## Generate a Document {#generate-a-document}

Use the **Generate Document** action to create a document from one of your templates.

1. Select the template to use for generation.
2. Provide the [dynamic data](../code-templates/defining-dynamic-data.md) as a JSON payload. This data populates the variables defined in your template.
3. Optionally attach [metadata](#metadata) (such as a custom filename or a reference ID for downstream processing).

> [!NOTE]
> **Naming variables**
>
> Variable names in your template must follow specific formatting rules. See the [naming variables](../code-templates/defining-dynamic-data.md#naming-your-variables) reference for correct and incorrect formats.


Document generation is asynchronous: the action sends the generation request and returns immediately. Use the [Document Generated trigger](#document-generated-trigger) below to react when the file is ready.

### Custom Filename {#custom-filename}

You can specify a custom name for the generated file. This is useful when storing documents in services like Google Drive, Dropbox, or another cloud storage platform.

Keep these restrictions in mind:

- The filename must not contain any slash `/` or backslash `\`
- Non-latin characters should be avoided as they can be corrupted when saving the file

Short names based on dates or IDs tend to work best.

> [!TIP]
> For more details on filename options (including setting filenames via the API), see [Custom Filename](../generating-documents/custom-filename.md).


### Metadata {#metadata}

When you generate a document, you can attach metadata to it. Metadata is not available in the template and does not influence the document content; it is simply attached to the document for later use.

A common use case is receiving the document via a [webhook](../generating-documents/webhooks.md) and using its metadata to route or handle it differently in your automation.

## Document Generated Trigger {#document-generated-trigger}

Use the **Document Generated** trigger to start a recipe when a document finishes generating. This is the recommended way to handle the asynchronous generation workflow.

The trigger provides the completed document's data, including:

- **Download URL** — a temporary link to the generated file (valid for 1 hour). See [Download URL](../generating-documents/download-url.md) for details.
- **Filename** — the name of the generated file
- **Metadata** — any metadata attached during generation
- **Status** — the generation result (`success` or `failure`). See [Document Statuses](../generating-documents/document-statuses.md) for the full lifecycle.

You can filter by template to ensure the recipe only runs for documents from a specific template.

> [!WARNING]
> **Dynamic data is not included**
>
> The trigger does not include the original dynamic data (payload) you sent to generate the document. If you need this information in later recipe steps, store it in the [metadata](#metadata) field when generating the document.


## Delete a Document {#delete-a-document}

Use the **Delete Document** action to remove a previously generated document from your PDFMonkey account. This is useful for cleaning up documents after they have been downloaded, emailed, or stored elsewhere in your workflow.

> [!TIP]
> **Automatic cleanup**
>
> Instead of manually deleting documents, consider using [automatic deletion (TTL)](../generating-documents/retention-and-deletion.md) to have documents cleaned up after a configurable period.


## Example Recipes {#example-recipes}

### Form Submission to Document to Email {#form-to-email}

1. Trigger on a form submission (from a connected app).
2. Use **Generate Document** to create the document with the form data.
3. Use **Document Generated** to wait for the file.
4. Download the file and send it as an email attachment.

### CRM Record to Document to Cloud Storage {#crm-to-storage}

1. Trigger on a new or updated CRM record.
2. Use **Generate Document** to create a contract, invoice, or report.
3. Use **Document Generated** to get the [download URL](../generating-documents/download-url.md).
4. Upload the file to Google Drive, Dropbox, or another storage service.

### Generate, Store, and Clean Up {#generate-store-cleanup}

1. Trigger on an event in your app (new order, approved contract, etc.).
2. Use **Generate Document** to create the file.
3. Use **Document Generated** to get the download URL.
4. Upload the file to permanent storage (S3, Google Drive, Sharepoint).
5. Use **Delete Document** to remove the file from PDFMonkey.

## Troubleshooting {#troubleshooting}

### Download URL Expired {#download-url-expired}

The [download URL](../generating-documents/download-url.md) is valid for 1 hour. If a later step in your recipe fails because the URL has expired, restructure your recipe so the download happens immediately after the **Document Generated** trigger fires.

For more details, see [Download URL Returns 403](../troubleshooting/download-url-gives-403.md).

### Template Not Published {#template-not-published}

If the generated documents do not reflect your latest template changes, the most likely cause is an unpublished template. Open your template in PDFMonkey and click **Publish** before running the recipe again.

> [!WARNING]
> **Common mistake**
>
> Forgetting to publish your template is a frequent error, especially when switching between Workato and PDFMonkey. Always publish after making changes.


## Next Steps {#next-steps}

- [From Zero to First Document](../getting-started/from-zero-to-first-document.md): Set up your PDFMonkey account and create your first template
- [Defining Dynamic Data](../code-templates/defining-dynamic-data.md): Learn how to structure the JSON payload for your templates
- [Custom Filename](../generating-documents/custom-filename.md): Control the name of generated files
- [Document Statuses](../generating-documents/document-statuses.md): Understand the lifecycle of a generated document
- [Webhooks](../generating-documents/webhooks.md): Receive real-time notifications when documents finish generating
- [Retention and Deletion](../generating-documents/retention-and-deletion.md): Set up automatic document cleanup with TTL
- Explore other integrations: [Zapier](./zapier.md), [Make](./make.md), [n8n](./n8n.md)


## FAQ

**How do I generate documents with PDFMonkey and Workato?**

Add the PDFMonkey connector to your Workato recipe, enter your API Secret Key to connect, then use the Generate Document action to create a document from a template with your dynamic data payload.

**How do I know when a PDFMonkey document is ready in Workato?**

Use the Document Generated trigger to start a recipe step when a document finishes generating. It provides the download URL, filename, metadata, and status. You can filter by template so the recipe only runs for specific documents.

**Can I automatically delete documents after processing in Workato?**

Yes. Use the Delete Document action in a later recipe step to remove the document from PDFMonkey after you’ve downloaded, emailed, or stored it. Alternatively, configure automatic deletion (TTL) in PDFMonkey to clean up documents after a set period.
