Hi All.
Below are the steps to send a Slack Message using External APIs.
Step 1: Create a connection in Connectors 2.0 using the Custom Connector
Screenshot:
Step 2: Go to Administrator → External Actions
There you can see all the connection names which we created in Step 1
Screenshot:
Step 3: Click on “Create Action”. It will ask you to choose the connector.
Screenshot:
Step 4: Provide a Action Name. And in the POST URL we have to provide the Webhooks URL for your Slack Group to where you want to Post the Message.
Screenshot:
The POST Url will vary from Group to Group
Step 5: In the Payload section wirte a JSON code in which format you have to send the message
Example:
{
"blocks":
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "New Customer Created
. Customer Name: {{Customer_Name}}
. ARR: USD{{ARR}}"
}
}
]
}
Step 6: Go to Fields Section and set the Data Types of those fields.
Screenshot:
Step 7: Click on “Create”. It will creates the connection.
Step 8: Click on “Test” to test it.
Screenshot:
It will open a page where you can enter some smaple data and click on “Test Action”
Screenshot:
After you press on the Test Action the data will send to the Slack Group.
Screenshot:
The POST URL which I provided was the Lions group slack channel.
Now will see how to get that POST URL.
Note: To get that URL you must have the Admin Permission to the Slack Workspace.
Step 1: Open any browser and press the “api.slack.com”
Step 2: click on “Start Building” button.
Screenshot:
Step 3: Create a Slack App by selecting the “Create New App” button.
Screenshot:
Step 4: Provide the App Name and Select the Slack Workspace which you have a Admin Rights
Screenshot:
It will show all the App in the App List Screen
Screenshot:
Step 5: Click on the App that which you created. And go to “Add features and functionality” section and click on the “Incoming Webhooks” section.
Screenshot:
And activate the option for Incoming Webhooks
Screenshot:
And in the same screen you have to click on the “Add New Webhook to Workspace” button.
It will route us to a new page where you have to choose the Slack group from the Dropdown.
Screenshot:
Choose a Slack Group and click Allow.
It will generate a Webhook URL to the selected channel.
Screenshot:
Note: you can create a Rule using “External API” Action to dynamically post message based on your criteria.
Thanks.