Integrate with Microsoft Teams
Build a Doc integrates seamlessly with Microsoft Teams through Power Automate, enabling document generation triggered by Teams messages and notifications posted back to channels.
Teams Triggers
Use Teams as a trigger source for document generation workflows:
| Trigger Type | Use Case |
|---|---|
| Channel message received | Keyword-based document requests |
| Adaptive card submission | Form-based document requests |
| Scheduled message | Recurring document generation |
Creating a Message Trigger
To trigger document generation from Teams channel messages:
- Create an Instant cloud flow in Power Automate
- Select When a new channel message is added as the trigger
- Configure your team and channel
- Add a Condition to detect a trigger phrase or keyword
Posting Notifications to Teams
Share document generation results with your team:
- Add Teams: Post message in a chat or channel action
- Include:
- Confirmation message
- Link to the generated document (from SharePoint)
- Relevant metadata (date, document type)
- Optionally attach the document directly
Notification Message Format
Your invoice has been generated and saved to SharePoint.Document: @{outputs('Create_file')?['body/DisplayName']}Link: @{outputs('Create_file')?['body/Path']}Generated: @{utcNow()}Adaptive Cards for Rich Notifications
Use Adaptive Cards for interactive Teams notifications:
- Add Teams: Post adaptive card in a chat or channel
- Design your card with:
- Document summary
- Key metadata
- Action buttons (View, Download, Approve)
Example: Teams-Triggered Document Generation
Trigger: When a channel message is added│├── Condition: Check for trigger phrase (e.g., "Generate Invoice")│├── Get template from SharePoint├── Get data source from SharePoint│├── Build a Doc: Convert Word Document│ - Data: Retrieved from SharePoint│ - Output: PDF│├── Create file in SharePoint│└── Post notification to Teams channel └── Include document link and summaryBest Practices
Trigger Phrase Management
- Use clear, consistent trigger phrases
- Document trigger keywords for users
- Consider case-insensitive matching
Message Formatting
- Keep notifications concise
- Always include shareable document links
- Add timestamps for tracking
- Use adaptive cards for complex notifications
Channel Permissions
- Verify the Flow Bot has posting permissions
- Use public channels for broader access
- Consider hybrid approaches (email + Teams) for sensitive documents
Troubleshooting
Teams Message Won’t Post
- Verify the channel is public (private channels require explicit Flow Bot access)
- Confirm Teams connector has channel posting permissions
- Add the Flow Bot to private channels manually if needed
Trigger Phrase Not Detected
- Check condition logic for exact text matching
- Use debugging (Compose actions) to inspect message content
- Consider whitespace and special characters
Adaptive Card Not Rendering
- Validate JSON structure in the adaptive card payload
- Test card in Teams App Studio before deploying
- Check for unsupported field types or formatting