Example workflows (ready to adapt) – Generation-created automation (webhook)
This workflow automates post-generation tasks in DocuWriter.ai. It triggers on new generations, branches by type (Documentation vs Tests), fetches full details, and then:
- Saves documentation to Google Drive
- Commits generated tests to GitHub
- Sends Slack notifications
You can import it directly into n8n and customize folder IDs, repo names, and channels.
Workflow Overview
flowchart TD
A[Webhook Trigger<br/>generation.created] --> B{Generation Type?}
B -->|Documentation| C[Fetch Generation Details]
C --> D[Save to Google Docs]
D --> E[Notify Team (Slack)]
B -->|Tests| F[Generate Tests]
F --> G[Commit Tests to GitHub]
G --> H[Notify Tests (Slack)]
Prerequisites
- n8n (Node.js ≥ 18.10, pnpm)
- Credentials configured in n8n:
- DocuWriter.ai API (API Token)
- Google Drive OAuth2 (Service Account)
- GitHub OAuth2
- Slack
Workflow Steps
| Step | Node Name | Type | Purpose |
|---|---|---|---|
| 1. Trigger on new generation | Generation Created | DocuWriter.ai Trigger | Listens for generation.created events |
| 2. Branch by generation type | Is Documentation? | If | Routes Documentation vs Tests |
| 3a. Fetch full generation content | Fetch Generation Details | DocuWriter.ai Action | Retrieves the generated content |
| 4a. Save docs to Google Drive | Save to Google Docs | Google Drive – create document | Creates an HTML doc with generated text |
| 5a. Notify via Slack | Notify Team (Slack) | Slack – post message | Alerts team with a link to the doc |
| 3b. Generate test code | Generate Tests | DocuWriter.ai Action | Produces test cases from source code |
| 4b. Commit tests to GitHub | Commit Tests to GitHub | GitHub – create file | Commits *.test.js with generated tests |
| 5b. Notify via Slack | Notify Tests (Slack) | Slack – post message | Alerts team that tests are available |
Importing the Workflow
- Download
examples/workflows/generation-created-webhook.json. - In n8n, click Import → File → select the JSON.
- Adjust credentials and placeholder values.
{
"name": "DocuWriter.ai Generation Created Automation",
"nodes": [
{
"id": "webhook-trigger",
"type": "n8n-nodes-docuwriter-ai.docuWriterTrigger",
"parameters": {
"event": "generation.created",
"filterByGenerationType": true,
"generationTypes": ["Documentation","Tests"]
},
"credentials": { "docuWriterApi": { "name": "DocuWriter.ai API" } }
}
// … other nodes …
]
}
Customization Points
- YOUR_GOOGLE_DRIVE_FOLDER_ID – folder for docs
- YOUR_GITHUB_USERNAME / YOUR_GITHUB_REPOSITORY – repo to commit tests
- Slack channel – e.g.
#dev-team - Adjust branch names, commit messages, and message templates
Node Details
1. Generation Created (Trigger) 🎯
- Type:
docuWriterTrigger(Webhook) - Event:
generation.created - Filters by Type: Documentation & Tests
- Credentials: DocuWriter.ai API
2. Is Documentation? (Branch) 🔀
- Type:
n8n-nodes-base.if - Condition:
{{$json.data.generation_type}} === 'Documentation'
Documentation Branch
- Fetch Generation Details
- Type:
docuWriter - Operation:
generations.get - Input:
generationIdfrom trigger
- Type:
- Save to Google Docs
- Type:
googleDrive(create document) - Body: HTML including filename, author, timestamp, generated content
- Type:
- Notify Team (Slack)
- Type:
slack - Message: 📚 Documentation saved, with button to view in Drive
- Type:
Tests Branch
- Generate Tests
- Type:
docuWriter - Resource:
codeTests.generate - Input: source code & filename from trigger
- Type:
- Commit Tests to GitHub
- Type:
github(create file) - Path:
tests/{{$node["Generation Created"].json["data"]["filename"]}}.test.js - Content: tests from previous node
- Type:
- Notify Tests (Slack)
- Type:
slack - Message: 🧪 Tests generated and committed, with file & repo info
- Type:
Credentials Setup
{
"commands": {
"npm": "npm install n8n-nodes-docuwriter-ai",
"yarn": "yarn add n8n-nodes-docuwriter-ai",
"pnpm": "pnpm add n8n-nodes-docuwriter-ai",
"bun": "bun add n8n-nodes-docuwriter-ai"
}
}
- Create DocuWriter.ai API credentials with your token and base URL.
- Configure Google Drive service account with appropriate scopes.
- Connect GitHub OAuth2 and Slack integrations in n8n.
By following this example, you can kick‐start AI-driven documentation and testing automation in your CI/CD pipeline.
Updated