Send branded order confirmation PDFs from Cognito Forms

By General Input

Every new Cognito Forms submission turns into a branded PDF, files itself in Google Drive, and emails the customer a confirmation in seconds.

Integrations

  • Cognito Forms
  • Google Drive
  • Gmail

Type

Deterministic Code

Categories

  • Operations
  • Finance

Build me a code workflow that runs every time a customer submits one of my Cognito Forms forms (for example an order form, event registration, waiver, or intake form) and produces a branded confirmation PDF, files it in Google Drive, and emails it to the customer. Every step is deterministic with structured inputs, so this should be a code workflow with discrete nodes, not an agent.

Trigger: a webhook from Cognito Forms fired on Entry Submitted for the specific form I configure. The webhook payload includes the entry number, the form internal name or id, and the entry field values (including the customer's email field, name, and any order details).

Step 1, generate the PDF. Use Cognito Forms Get Document with the form name or id, the entry number from the webhook, and the id of a preconfigured document template I have already set up on the form. The response is the PDF bytes. Name the file using the form name and entry number, for example OrderForm-1234.pdf.

Step 2, file the PDF in Google Drive. Use Google Drive Create Folder if needed to lazily create a records folder named after the form and the current date (for example /Confirmations/OrderForm/2026-05-18), parented under a root folder id I provide in config. Cache or look up the folder by name so we do not create duplicates. Then use Google Drive Upload File (Multipart) to upload the PDF into that folder with the file name from step 1 and mime type application/pdf. Keep the returned Drive file id and webViewLink for step 3.

Step 3, email the customer. Use Gmail Send a Message to the recipient address pulled from the configured email field on the entry. Subject should be short and transactional, for example "Your confirmation for {form name} #{entry number}". Body should be a short branded message confirming receipt and referencing the entry number. If the PDF is at or under about 20 MB, attach it directly to the email. If it is larger, skip the attachment and instead include the Google Drive webViewLink in the email body so the customer can open it from Drive.

Config I should be able to set per deployment: the Cognito Forms form name or id, the document template id, the email field name on the form, the root Google Drive folder id, the folder naming pattern (default: {formName}/{YYYY-MM-DD}), the email subject template, the email body template, optional CC or BCC addresses (for example a finance@ inbox for paper trail), and the attachment size threshold (default 20 MB).

Error handling: if Get Document fails (404 entry, 403 permissions, or 5xx), retry with exponential backoff a couple of times, then surface a clear error. If the Drive upload fails, retry similarly. If the Gmail send fails, retry, and if it still fails do not lose the PDF: it is already in Drive, so log the Drive link so a human can follow up. Treat the webhook as idempotent on entry number so a duplicate delivery does not produce duplicate emails.

Credentials: Cognito Forms API key, Google Drive OAuth, Gmail OAuth. The Drive and Gmail credentials can be the same Google account.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findCandidate rediscovery desk for your archived Lever applicantsLaytime and demurrage claim workspace for chartering opsKajabi customer support console for member access fixesRun your application review round on Jotform submissionsAd creative studio with a pre-approved variant libraryFilter every signed Ironclad contract and brief it on demandArtwork desk for the Notion posts still missing an image