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:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/e2c6f050-7ecd-464d-a1b6-4460960074f0.png)
Step 2: Go to Administrator → External Actions
There you can see all the connection names which we created in Step 1
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/ab36c61f-1fda-4104-8822-ae88e0bb3398.png)
Step 3: Click on “Create Action”. It will ask you to choose the connector.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/0af8cef3-da01-4bbb-a6ef-00e7859a371a.png)
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:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/2de3749b-1ca8-4793-aa24-342c11843743.png)
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:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/c3a30d18-b5a4-44c1-a7fc-4b15e7b5fe9f.png)
Step 7: Click on “Create”. It will creates the connection.
Step 8: Click on “Test” to test it.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/c72e7fb8-902d-4e5d-a5d2-85ee9c709fd6.png)
It will open a page where you can enter some smaple data and click on “Test Action”
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/f9c64b90-7ad6-475b-93fe-d6ad493f4cc1.png)
After you press on the Test Action the data will send to the Slack Group.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/cc44e4b2-fe53-4d45-8bde-d631542e8d96.png)
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:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/8f6dea96-80da-46e6-9c45-edf667e15335.png)
Step 3: Create a Slack App by selecting the “Create New App” button.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/7910edd2-fec5-4003-a7e6-8158f5b18900.png)
Step 4: Provide the App Name and Select the Slack Workspace which you have a Admin Rights
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/7300968f-697f-481c-b3c1-d4f2808fc46f.png)
It will show all the App in the App List Screen
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/b8fa7710-2c76-4069-8cf4-a0222213730e.png)
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:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/ead95ac4-c906-4999-929e-dcd7486e9b26.png)
And activate the option for Incoming Webhooks
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/191726cb-c7c6-470f-95ca-bf2bb1f2b829.png)
And in the same screen you have to click on the “Add New Webhook to Workspace” button.
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/4f6781eb-0cb1-4915-8323-7b32518c11a6.png)
It will route us to a new page where you have to choose the Slack group from the Dropdown.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/efce203b-d3e3-4feb-9416-b49ab6927aec.png)
Choose a Slack Group and click Allow.
It will generate a Webhook URL to the selected channel.
Screenshot:
![](https://uploads-us-west-2.insided.com/gainsight-us/attachment/e5af1e3e-90a8-4903-ab03-d3f5a40e430c.png)
Note: you can create a Rule using “External API” Action to dynamically post message based on your criteria.
Thanks.