The problem in two lines
Your billing, subscription or contract system sends webhooks, and you want Salesforce to generate a contract (often a 40–60 page Word/PDF template) and send it for signature without a human clicking a button. You don’t want to install a package or add a browser plugin, and you want the flow to work from a middleware or a simple webhook.
Salesforce document generation integration — the practical options
Savvy DocuGen triggers from four events: a button, a stage change, a field change, or a new file on the record. That’s the starting point. External systems can cause any of those four triggers by calling Salesforce APIs or producing messages a subscriber in your org consumes. Below are patterns that actually work in production and the trade-offs for a developer.
1) Update a field via the REST API (recommended for simplicity)
Make your external system PATCH or PATCH-like the record to flip a checkbox or set a status field that you’ve configured to start the DocuGen flow. This is the simplest, lowest-latency approach and keeps logic inside Salesforce Flows or Process Builder.
Example: the subscription system receives a webhook saying an account is ready for renewal. It calls Salesforce and sets Renewal_Send_for_Signature__c = true on the Opportunity or Contract. A Flow watching that field kicks off the DocuGen template and sends to Circularo.
curl -X PATCH \
https://yourInstance.salesforce.com/services/data/v56.0/sobjects/Opportunity/006XXXXXXXXXXXX \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"Renewal_Send_for_Signature__c": true}'
Why this pattern: it's simple, auditable in the Opportunity history, and you can add pre-conditions in the Flow (only run for opportunities with Account.Type = 'Customer', only for amounts above X, etc.).
2) Upload a file to trigger on-new-file
If your integration already produces a populated Word or PDF, push that file into Salesforce as a ContentVersion (Files) or as Notes & Attachments. Savvy DocuGen can be configured to run when a new file appears on a record.
Use Files (ContentVersion) unless the documents are smaller than 25 MB and you specifically need Notes & Attachments. Savvy DocuGen accepts documents up to 40 MB; Salesforce Notes & Attachments has a 25 MB cap and cannot be increased.
curl -X POST \
https://yourInstance.salesforce.com/services/data/v56.0/sobjects/ContentVersion \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{"Title":"Renewal Agreement","PathOnClient":"Renewal.pdf","VersionData":"","FirstPublishLocationId":"006XXXXXXXXXXXX"}'
Why this pattern: use it when the external system already produces the document or you want to attach negotiation artifacts that then trigger further processing.
3) Publish a Platform Event + subscriber Flow or Apex (for decoupling)
If you want to keep the external system out of your core object model, publish a Platform Event from the integration (or from middleware). Create a Flow or small Apex trigger that subscribes to that Platform Event and updates the target record or creates a lightweight mediator record that DocuGen watches. This keeps your integration asynchronous and resilient.
Note: Platform Events don’t change records by themselves — you’ll need the subscriber. The benefit is throttling and replay control in Salesforce.
4) Call a custom Apex REST endpoint (fine when you need custom validation)
Expose a narrow, authenticated Apex REST endpoint that your external system calls. The endpoint can validate payloads, look up Contacts to set signer emails, then update the record or create a temporary trigger record that DocuGen watches.
I prefer this only when you need server-side validation or transformation that’s easier in Apex than in middleware. Keep the endpoint lightweight and push longer work to asynchronous processing (Queueable/Platform Events) to avoid hitting synchronous limits.
Handling signer identity and security
When DocuGen sends for signature through Circularo, signer identity options include an emailed one-time code and a per-signer password read from a field on that signer’s Salesforce record. If the external system supplies new Contacts, make sure you populate the Contact record with the expected password or an identifier your Flow will use to set the per-signer password field.
Also remember: Savvy DocuGen connects through an authorised connection and there’s no managed package to install. It works in sandboxes exactly as in production.
Bulk, throttling and large volumes — what to watch for
External systems often send batches. Don’t jam Salesforce with hundreds of synchronous calls. Instead:
- Batch updates into groups and use the REST Bulk API when you can.
- Use Platform Events to absorb spikes and let Salesforce process at its own pace.
- If a single run will merge many child records (line items or related payments), make sure your DocuGen template uses child rows so the document fills correctly from related lists.
Illustrative scenario: if you have 200 renewals a month and each is a 60-page agreement generated from Opportunity + child QuoteLineItems + related Account contacts, push a single API update per record to flip a checkbox and let the org’s Flows handle the rest. That keeps your middleware simple and avoids excessive API calls.
Developer checklist before you integrate
- Decide trigger method: field update, new file, Platform Event or Apex endpoint.
- Confirm file size expectations. Use Files for >25 MB; DocuGen supports up to 40 MB.
- Model signer data on Contact or a dedicated signer object (include per-signer password field if required).
- Add Flow/Apex guards so DocuGen runs only when data quality checks pass (address present, amount signed-off, no duplicate runs).
- Test in a sandbox. Savvy DocuGen works in sandboxes exactly like production.
Triggering document generation and e-signature from an external system is usually simpler than it looks: make the external system change something Salesforce already watches, and keep the heavy lifting inside Salesforce Flows or reliable async subscribers.
Savvy DocuGen fills Word and PDF templates from any Salesforce record, sends for signature through your Circularo account, and writes the signed PDF back to the record. Try it in your sandbox and run a few webhook-to-document scenarios to see which trigger pattern fits your architecture best.
Ready to test in your sandbox? Install nothing — just authorise the connector and try a checkbox-flip or file upload to watch a real end-to-end run.
Read next