Chatter Post Automation from Teams
When a message is posted to a specific Teams channel with a #salesforce hashtag, uses Salesforce SendHTTPRequest to POST to the Chatter REST API, creating a corresponding Chatter feed item on the linked Salesforce record.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow bridges Microsoft Teams and Salesforce Chatter by monitoring a designated Teams channel for messages tagged with #salesforce and a Salesforce record ID (using the #SF:<recordId> format). When a matching message is detected, the flow extracts the record ID, cleans the message content, and posts it as a Chatter feed item on the corresponding Salesforce record via the Salesforce connector's HttpRequest action. A confirmation message with a direct Salesforce link is posted back to the Teams channel.
Use Case
Sales teams and account managers often discuss Salesforce records (accounts, opportunities, cases) in Microsoft Teams channels. This flow eliminates the context switch between Teams and Salesforce by automatically creating Chatter feed items from Teams messages. Team members simply include #salesforce #SF:001XXXXXXXXXXXX in their Teams message, and the relevant discussion is logged directly on the Salesforce record for CRM visibility.
Flow Architecture
When a New Channel Message Is Added
Teams OnNewChannelMessage (polling, every 3 min)Monitors a configured Teams channel for new messages.
Init varSalesforceInstanceUrl
Initialize VariableLoads Salesforce org base URL from the flowlibs_SalesforceInstanceUrl environment variable.
Init varChatterApiVersion
Initialize VariableLoads Salesforce REST API version from the flowlibs_SalesforceChatterApiVersion environment variable.
Init varTeamsGroupId
Initialize VariableLoads Teams Group ID from the flowlibs_TeamsGroupId environment variable.
Init varTeamsChannelId
Initialize VariableLoads Teams Channel ID from the flowlibs_TeamsChannelId environment variable.
Compose Message Text
ComposeExtracts the message body content from the trigger output.
Check If Message Contains Salesforce Tag
If conditionChecks for both `#salesforce` AND `#SF:` in the message text.
- Extract Salesforce Record ID — Compose action that parses the record ID from after `#SF:` to the next space.
- Compose Clean Message for Chatter — Compose action that strips hashtags and prepends the Teams sender name.
- Compose Chatter Payload — Compose action that builds the Chatter feed-elements JSON payload.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <configure> | The Microsoft 365 Group ID for the Teams team that contains the channel to monitor. |
| flowlibs_TeamsChannelId | String | <configure> | The channel ID to monitor for Salesforce-tagged messages. |
| flowlibs_SalesforceInstanceUrl | String | https://yourorg.my.salesforce.com | Base URL of your Salesforce org, used for building record links in the Teams confirmation message. |
| flowlibs_SalesforceChatterApiVersion | String | v60.0 | Salesforce REST API version used in the Chatter endpoint path. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Teams | shared_teams | OnNewChannelMessage (trigger) PostMessageToConversation |
| Salesforce | shared_salesforce | HttpRequest (Chatter REST API call) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Configure environment variables
- Update all four env vars with your tenant-specific values: Teams Group ID, Teams Channel ID, Salesforce instance URL, and Chatter API version.
- Authorize connections
- Open the flow in the designer, click each connection reference, and sign in with appropriate Teams and Salesforce credentials.
- Customize the hashtag pattern
- The flow looks for #salesforce and #SF:<recordId>. Modify the condition expression in the Check If Message Contains Salesforce Tag step to change the trigger pattern.
- Change the Chatter API version
- Update the flowlibs_SalesforceChatterApiVersion env var if your org requires a different REST API version.
- Add error handling
- Consider wrapping the Salesforce HttpRequest in a Scope with a configured run-after Catch scope for production use.
- Extend the Chatter payload
- The current payload posts a simple text feed item. Add @mentions, attachments, or capabilities to the Chatter JSON payload for richer posts.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Record ID extraction
Splits on `#SF:`, takes everything after it, then splits on space and takes the first token.
EXPR.02Clean message for Chatter
Strips both hashtag patterns and prepends the sender's display name.
EXPR.03Chatter API URI
Relative URI used by the Salesforce HttpRequest connector action.
EXPR.04Salesforce record link
Builds a direct link to the record in Salesforce for the Teams confirmation message.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.