Skip to main content

Pipedream

Prerequisites

  • A PolyDoc account and API key — sign up for free, no credit card required. The free plan includes 150 PDF conversions per month.
  • A Pipedream account — sign up for free with generous free-tier limits.

Use Case 1: Generate PDFs with Code Steps

Use Pipedream's code steps to call the PolyDoc API with full control over the request, then email the resulting PDF.
HTTP trigger / Schedule → Node.js code step (PolyDoc API) → Email step

Create a workflow with a trigger

Click New Workflow and choose a trigger: select HTTP / Webhook for on-demand requests, or Schedule to generate PDFs at regular intervals (e.g., daily reports).

Screenshot placeholder: /img/guides/pipedream/pipedream-uc1-create-workflow.png

Add a Node.js code step

Click the + below the trigger and select Node.js (or Python). This gives you a code editor where you can write your PolyDoc API call with full flexibility.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc1-add-code-step.png

Write the PolyDoc API call

Write the API call in the code step. Here's an example using axios:

import { axios } from "@pipedream/platform";

export default defineComponent({
  async run({ steps, $ }) {
    const response = await axios($, {
      method: "POST",
      url: "https://api.polydoc.tech/pdf/convert",
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
        "X-Sandbox": "true",
      },
      data: {
        templateId: "YOUR_TEMPLATE_ID",
        data: {
          name: steps.trigger.event.body.name,
          amount: steps.trigger.event.body.amount,
        },
      },
      responseType: "arraybuffer",
    });

    $.export("pdf", Buffer.from(response).toString("base64"));
  },
});

Replace YOUR_API_KEY with your key from the Dashboard and map the data fields to match your template variables.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc1-code-step.png

Send the PDF by email

Add a Send Email action step (or use the Gmail app). Set the recipient, subject, and attach the PDF binary exported from the previous step.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc1-email-step.png

Deploy the workflow

Click Deploy to make the workflow live. Send a test request (or wait for the schedule) and verify the PDF is generated and emailed correctly.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc1-deploy.png

Use Case 2: HTTP Endpoint Returns PDF

Build an HTTP endpoint that accepts JSON, generates a PDF via PolyDoc, and returns the binary PDF directly in the response.
HTTP trigger (with body) → Code step (PolyDoc) → Return PDF in response

Create a workflow with an HTTP trigger

Create a new workflow and select HTTP / Webhook as the trigger. Choose Return a custom response so you can send the PDF back to the caller. Copy the generated endpoint URL.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc2-http-trigger.png

Add a code step for PolyDoc

Add a Node.js code step that calls PolyDoc and returns the PDF:

import { axios } from "@pipedream/platform";

export default defineComponent({
  async run({ steps, $ }) {
    const { body } = steps.trigger.event;

    const response = await axios($, {
      method: "POST",
      url: "https://api.polydoc.tech/pdf/convert",
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
        "X-Sandbox": "true",
      },
      data: {
        templateId: "YOUR_TEMPLATE_ID",
        data: body,
      },
      responseType: "arraybuffer",
    });

    await $.respond({
      status: 200,
      headers: {
        "Content-Type": "application/pdf",
      },
      body: Buffer.from(response),
    });
  },
});
Screenshot placeholder: /img/guides/pipedream/pipedream-uc2-code-step.png

Return the PDF in the response

Click Deploy. The workflow is now live at your unique endpoint URL.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc2-deploy.png

Test with a POST request

Send a test POST request to the endpoint and confirm you receive a PDF back:

curl -X POST <YOUR_ENDPOINT_URL> \
  -H "Content-Type: application/json" \
  -d '{"name": "Test User", "amount": "€500.00"}' \
  --output test.pdf

Open test.pdf to verify the content matches your template.

Screenshot placeholder: /img/guides/pipedream/pipedream-uc2-test.png