A Slack channel is a virtual space within the Slack platform where team members can communicate with each other through messages, calls, file sharing, and integrations. Channels can be organized around specific projects, departments, or topics, and they can be either public (open to all members) or private (restricted to invited members).
By using channels, teams can collaborate and stay organized in real-time, regardless of their physical location.
In this issue today, we will share how to create a Slack channel while creating a new opportunity record when the deal is closed. So, let’s get started!
Installing Slack app in Salesforce
Before we start, you need to install the Slack App in your Salesforce org from Salesforce AppExchange. Click on the link here to install the Slack app.
Steps to create a slack channel and add a user with the opportunity record in the channel
- Step 1: We will create a channel and add an opportunity record in the channel to create Record Trigger Flow.
- In Quick Find Box Search Flows.
- Select Record Trigger Flow.
- Select the opportunity object.
- Configure Trigger.
- Add condition Requirements.
- Optimize the flow of Actions and Related Records.
- Check box check: Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.
- Step 2: In Run Asynchronously to add Slack Apex Action Create Channel.
- Add Slack App.
- Add Slack workspace.
- Add Execute Action As.
- Add Slack Channel Name.
- Add Channel Type.
- Step 3: After that, we will add a user. For that first, we will create resources.
- Click Variable.
- Give API name.
- Data Type set as Text.
- In Flow, we Add Assignments for Add user id.
- Step 4: Add Apex action to invite users.
- Add Slack App.
- Add Slack WorkSpace.
- Add Execute Action As.
- Add Slack Channel ID.
- Add Slack Workspace ID for Channel.
- Add Salesforce User ID Collection Resource.
- Step 5: Add Apex Action Send Slack Message.
- Add Slack App.
- Add Slack WorkSpace.
- Add Execute Action As.
- Add Slack Conversation ID.
- Add Slack Message.
To add Slack messages we will create a resource Select a text template and give an API Name And give View as Plain text.
- Final Step: In the end, the Flow will look like this.
- Now we will create an opportunity record and opportunity record sync with Slack and add a channel in Slack with an opportunity Record.
Conclusion
Hope you find this article article. To get more updates on the latest Salesforce development solutions, stay tuned to our blogs. Until the next blog, happy coding!