Automation library · Documents and files

Generate AI-powered contracts with OpenAI and Gmail

Started by another system calling it, and works across Gmail and Google Sheets. It hands the judgement calls to OpenAI. 26 steps, 3 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

26 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
1Loop or waits
2Services it connects to

The flow

Starts it 2Model 2Logic 16Service 6

The steps in the order they run, from what starts it.

  1. 1Contract Request WebhookWebhookStarts it
  2. 2OpenAI Chat ModelLm Chat Open AiModel
  3. 3Validate Contract RequestIfLogic
  4. 4AI Contract AdvisorAgentModel
  5. 5Prepare Contract DataSetLogic
  6. 6Invalid Request ResponseSetLogic
  7. 7Parse AI Contract ResponseCodeLogic
  8. 8Route by Contract TypeSwitchLogic
  9. 9Respond to WebhookRespond To WebhookStarts it
  10. 10Convert Markdown to HTMLMarkdownLogic
  11. 11NDA Template BaseSetLogic
  12. 12Service Agreement BaseSetLogic
  13. 13Employment Contract BaseSetLogic
  14. 14Generic Contract BaseSetLogic
  15. 15Prepare Signature RequestCodeLogic
  16. 16Merge Template DataMergeLogic
  17. 17Send to E-Signature ServiceHttp RequestService
  18. 18Send Signing Request EmailGmailService
  19. 19Wait for Signature WebhookWaitLogic
  20. 20Process Signature ResultCodeLogic
  21. 21Check Signature StatusIfLogic
  22. 22Log Completed ContractGoogle SheetsService
  23. 23Log Expired or PendingGoogle SheetsService
  24. 24Send Completion EmailGmailService
  25. 25Send Reminder or Expiry EmailGmailService
  26. 26Merge Final ResultsMergeLogic

How it's built

Starts on
Another system calling it
Steps
26, with 3 branches, 1 loop or waits
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Google Sheets
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail and Google Sheets accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 26 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 26 steps before you point it at anything that matters.