{"id":5204,"date":"2023-05-16T12:33:09","date_gmt":"2023-05-16T12:33:09","guid":{"rendered":"https:\/\/unremot.com\/blog\/?p=5204"},"modified":"2023-05-16T12:34:13","modified_gmt":"2023-05-16T12:34:13","slug":"how-to-use-slack-api","status":"publish","type":"post","link":"https:\/\/unremot.com\/blog\/how-to-use-slack-api\/","title":{"rendered":"How to use Slack API &#8211; a step-by-step integration guide and full documentation list"},"content":{"rendered":"<p>This article will discuss on how to use Slack API &#8211; a step-by-step integration guide and full documentation list. Let&#8217;s get started!<\/p>\n\n<h2><strong>Overview of Slack API<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Slack API grants provision to developers for creating custom applications, workflows, and data exchange both ways. The APIs provided by Slack are capable to query various types of information and accordingly create activities in a Slack-controlled workspace.\u00a0<\/span><span style=\"font-weight: 400;\">You only need to choose the right Slack API, the details of which are available on the <a href=\"https:\/\/api.slack.com\/start\/planning\/choosing\" target=\"_blank\" rel=\"noopener\">website<\/a>.<\/span><\/p>\n<h2><strong>List of Slack APIs and functionalities<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">As a first step towards how to use Slack API, let us first understand what are the different types of Slack integrations API and their functionalities.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Slack Real Time Messaging API:<\/strong> It helps to display an event or a message inside the Slack instance or workspace in one or single feed. An instance can be, say suppose, you want to monitor when a member of a team reacts to a message. You can build a program using Slack API for real-time messaging.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Slack Events API:<\/strong> It helps to control and specify a set of actions or events you want to monitor or capture in the Slack instance or workspace. For example, if you want to monitor a group of messages from a certain user, then it&#8217;s good to use this Slack API.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Slack Web API:<\/strong> It works along with the Events API. While the Events API is responsible for sending information from the Slack instance to any other application, the Web API is responsible for receiving the response.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\"><strong>Slack API conversations:<\/strong> It is just a subset of the Slack app API for Web, providing additional features of allowing changes to public, private, and shared channels and direct messages.<\/span><\/li>\n<\/ol>\n<p style=\"text-align: center;\"><strong>Also read:\u00a0<a href=\"https:\/\/unremot.com\/blog\/how-to-use-chatgpt-api\/\">How to use ChatGPT API; a step-by-step integration guide and full documentation list<\/a><\/strong><\/p>\n<h2><strong>How to use Slack API &#8211; 7 step integration guide<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Let us now discuss how to use Slack API, here are the steps.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The Http RPC-style methods need to be called by passing on the following arguments<\/span><\/li>\n<\/ol>\n<ul>\n<li><span style=\"font-weight: 400;\">GET querystring parameters<\/span><\/li>\n<li><span style=\"font-weight: 400;\">POST parameters for example application\/x-www-form-urlencoded<\/span><\/li>\n<li><span style=\"font-weight: 400;\">It can also be a mix of both POST and GET parameters<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The methods accept arguments that are JSON attributes<\/span><\/li>\n<li><span style=\"font-weight: 400;\">The files to be uploaded expect to send the parameters in the form of urlencoded\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 2. Set your content type header to application\/x-www-form-urlencoded. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0Here is the <a href=\"https:\/\/api.slack.com\/web\" target=\"_blank\" rel=\"noopener\">sample code.<\/a><\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 POST \/api\/conversations.create<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 Content-type: application\/x-www-form-urlencoded<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 token=xoxp-xxxxxxxxx-xxxx&amp;name=something-urgent<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 And then present your key\/value pairs<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">In the HTTP header, transmit the bearer Slack API token. Here is an example of a code for displaying a message with certain <a href=\"https:\/\/api.slack.com\/web\" target=\"_blank\" rel=\"noopener\">menus<\/a>.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">POST \/api\/chat.postMessage<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Content-type: application\/json<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Authorization: Bearer xoxp-xxxxxxxxx-xxxx<\/span><\/p>\n<p><span style=\"font-weight: 400;\">{&#8220;channel&#8221;:&#8221;C061EG9SL&#8221;,&#8221;text&#8221;:&#8221;I hope the tour went well, Mr. Wonka.&#8221;,&#8221;attachments&#8221;:[{&#8220;text&#8221;:&#8221;Who wins the lifetime supply of chocolate?&#8221;,&#8221;fallback&#8221;:&#8221;You could be telling the computer exactly what it can do with a lifetime supply of chocolate.&#8221;,&#8221;color&#8221;:&#8221;#3AA3E3&#8243;,&#8221;attachment_type&#8221;:&#8221;default&#8221;,&#8221;callback_id&#8221;:&#8221;select_simple_1234&#8243;,&#8221;actions&#8221;:[{&#8220;name&#8221;:&#8221;winners_list&#8221;,&#8221;text&#8221;:&#8221;Who should win?&#8221;,&#8221;type&#8221;:&#8221;select&#8221;,&#8221;data_source&#8221;:&#8221;users&#8221;}]}]}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Next you need to authenticate the requests of Slack API. The step is achieved by providing the bearer token. To negotiate tokens or on <\/span><span style=\"font-weight: 400;\">how to get Slack API token<\/span><span style=\"font-weight: 400;\">, you need to register your application with Slack and obtain the required credentials. The token can be sent as an HTTP header or in the POST parameter.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">For returning results in Slack rest API, use the cursor-based approach. This will help to return a certain portion of the total results set or point to the next portion of the result set. A sample code for a request to the next page and limited to 2 results<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">GET slack.com\/api\/users.list?limit=2&amp;cursor=dXNlcjpVMEc5V0ZYTlo%3D&amp;token=xoxp-1234-5678-90123<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Limit your apps with 1 request per second for any API call in Slack API integration<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Use the event API to deliver events that count up to 30,000 deliveries per workspace per hour<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You can initiate your application via the Slack integration API in two ways &#8211; via a Slash command like using \/mycallapp inside the composer. The other way is to use the Call icon.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To set up the app you need to call the Slash command. The command buttons can be found under Add features and functionality. You will find the option to Create a new command.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Slack then sends a payload to your app which looks as below,<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;token&#8221;: &#8220;&lt;verification token&gt;&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;team_id&#8221;: &#8220;T123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;team_domain&#8221;: &#8220;my-team&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;channel_id&#8221;: &#8220;C123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;channel_name&#8221;: &#8220;test&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;user_id&#8221; : &#8220;U123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;user_name&#8221;: &#8220;mattjones&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;response_url&#8221;:&#8221;https:\/\/slack.com\/callback\/123xyz&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;type&#8221;: &#8220;video&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You then need to post your response to the response_url of the Slack connect API. You need to enter the following<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">\u00a0{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;response_type&#8221;:&#8221;call&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;call_initiation_url&#8221;:&#8221;https:\/\/join.call.com\/123456&#8243;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;desktop_protocol_call_initiation_url&#8221;: &#8220;call:\/\/join&amp;room_id=123456&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">If you want to launch your app in desktop then use this <\/span><span style=\"font-weight: 400;\">desktop_protocol_call_initiation_url\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">If you want the call type to be video then you need to ensure the initiation URL begins with a video. If its audo, then you need to enter the phone number received in the payload. Code sample\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;response_type&#8221;: &#8220;audio&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;call_initiation_url&#8221;: &#8220;https:\/\/your_company_url\/&#8230;&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;desktop_protocol_call_initiation_url&#8221;: &#8220;your_call_app_url:\/\/+1-202-555-0145&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The calls.add method will now need to be used for adding the details of the call to the Slack webhook API. Store the id received as a response to refer while ending or updating the call<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Post the call to the channel. Sample code\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&#8220;blocks&#8221;: [<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;type&#8221;: &#8220;call&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;call_id&#8221;: &#8220;R123&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Next you need to unfurl a call in the channel. The sample code is\u00a0<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;token&#8221;: &#8220;xxxx-xxxxxxxxx-xxxx&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;channel&#8221;: &#8220;C123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;ts&#8221;: &#8220;12345.6789&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;unfurls&#8221;: {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;https:\\\/\\\/url.to\\\/your\\\/call&#8221;: {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;blocks&#8221;: [{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;type&#8221;: &#8220;call&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;call_id&#8221;: &#8220;Rxxx&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">While responding to a rejected call, the following sample payload needs to be utilized\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;token&#8221;: &#8220;12345FVmRUzNDOAuy4BiWh&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;team_id&#8221;: &#8220;T123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;api_app_id&#8221;: &#8220;B123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;event&#8221;: {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;type&#8221;: &#8220;call_rejected&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;call_id&#8221;: &#8220;RL731AVEF&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;user_id&#8221;: &#8220;U123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;channel_id&#8221;: &#8220;D123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;external_unique_id&#8221;: &#8220;123-456-7890&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0},<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;type&#8221;: &#8220;event_callback&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;event_id&#8221;: &#8220;Ev123ABC456&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;event_time&#8221;: 1563448153,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;authed_users&#8221;: [&#8220;U123ABC456&#8221;]<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To update a call use calls.update_method and to and add or modify participants or users, use calls.participants.remove<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To end a call, use the calls.end method<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">As a Slack API user, you can set up custom Slack API status, represented by the attributes status_text, status_emoji, and status_expiration profile attributes. You can retrieve the status of a user by using users.profile.get command<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You can set the custom status of a user through Slack API key or access token and entering into the users.profile.set method. The parameter for the profile must be a URL-encoded JSON string. The string must have the attribute as status_text<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Sample code:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_text&#8221;: &#8220;riding a train&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_emoji&#8221;: &#8220;:mountain_railway:&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_expiration&#8221;: 0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To unset the status, <\/span><span style=\"font-weight: 400;\">status_text, and status_emoji are set to empty<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">You can expire the status of the user, using status_expiration command.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\">Sample code<\/span><\/p>\n<p><span style=\"font-weight: 400;\">{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_text&#8221;: &#8220;riding the train home&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_emoji&#8221;: &#8220;:mountain_railway:&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;status_expiration&#8221;: 1532627506<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To manually mark a user as auto or away, use the command users.setPresence<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">For using slack bot API, use the command chat.postMessage for passing information<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Now coming to the usage of Slacks connect APIs that help users between organizations and different workspaces to work together in a Slack environment.<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">You need to invite users from different organizations into the workspace, transforming the channel into a Slack Connect channel<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Once the app is installed in the target workspace, then you need to accept the invitations from the Slack Connect channel<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">You can either approve, decline the invitations and then disconnect from the channel<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The other API which is of importance is the Slack Analytics API. You need to integrate within the channel enabling it to work along for providing insights and analysis of the way the company is leveraging Slack. Once it is integrated, it can extract the chats, messages, and members of the Slack API workspace.<\/span><\/li>\n<\/ul>\n<p style=\"text-align: center;\"><strong>Also read:\u00a0<a href=\"https:\/\/unremot.com\/blog\/how-to-use-youtube-api\/\">How To Use YouTube API; A Step-By-Step Guide To Integrate And Full Documentation List<\/a><\/strong><\/p>\n<h2><strong>Slack API documentation references<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Here are the key Slack API documentation references that serve as Slack API reference and Slack API tutorial.<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">For overview of Slack API, refer <a href=\"https:\/\/api.slack.com\/apis\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To understand the connection protocols, and socket mode implementation, follow the <a href=\"https:\/\/api.slack.com\/apis\/connections\" target=\"_blank\" rel=\"noopener\">Slack API docs<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Now coming to the usage guides, if you want to learn about using the web API, then click <a href=\"https:\/\/api.slack.com\/web\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">To know about Calls API, refer to this <a href=\"https:\/\/api.slack.com\/apis\/calls\" target=\"_blank\" rel=\"noopener\">link<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Details on Bookmark API can be checked <a href=\"https:\/\/api.slack.com\/apis\/bookmarks-api\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Now comes Slack connect and its APIs. Know more about it in the <a href=\"https:\/\/api.slack.com\/apis\/connect\" target=\"_blank\" rel=\"noopener\">document<\/a> link.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">The status API is another important Slack API which helps to check the health of the product. Here is the <a href=\"https:\/\/api.slack.com\/docs\/slack-status\" target=\"_blank\" rel=\"noopener\">tutorial<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">For information on Slack API web methods, refer to <a href=\"https:\/\/api.slack.com\/methods?ref=apis\" target=\"_blank\" rel=\"noopener\">this<\/a> link,<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Then comes event types, the details of which can be checked <a href=\"https:\/\/api.slack.com\/events?ref=apis\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">And then the last, to check object types here is the <a href=\"https:\/\/api.slack.com\/types?ref=apis\" target=\"_blank\" rel=\"noopener\">link<\/a>.<\/span><\/li>\n<\/ol>\n<h2><strong>Slack API examples<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Now let us see some Slack API examples, which will help beginners to be familiar with the coding, syntax, etc. These Slack API examples will further help to fast track the development activities, requiring considerably less time for completion. In the subsequent sections, we will be describing the same.<\/span><\/p>\n<h3><strong>How to use Slack API Python<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API Python SDK offers the full package for using the platform to install and build APIs. There are packages for Web API, Socket Mode, Webhooks, OAuth, and other APIs. <\/span><span style=\"font-weight: 400;\">Sample codes for <\/span><span style=\"font-weight: 400;\">real time API Slack python<\/span><span style=\"font-weight: 400;\"> to refer for installation. Here is the <a href=\"https:\/\/slack.dev\/python-slack-sdk\/\" target=\"_blank\" rel=\"noopener\">reference<\/a>.<\/span><\/p>\n<p><strong>The source code:<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">git<\/span> <span style=\"font-weight: 400;\">clone<\/span> <span style=\"font-weight: 400;\">https:\/\/github.com\/slackapi\/python-slack-sdk.git<\/span><\/p>\n<p><span style=\"font-weight: 400;\">cd<\/span> <span style=\"font-weight: 400;\">python-slack-sdk<\/span><\/p>\n<p><span style=\"font-weight: 400;\">python3<\/span> <span style=\"font-weight: 400;\">-m<\/span> <span style=\"font-weight: 400;\">venv<\/span> <span style=\"font-weight: 400;\">.venv<\/span><\/p>\n<p><span style=\"font-weight: 400;\">source<\/span> <span style=\"font-weight: 400;\">.venv\/bin\/activate<\/span><\/p>\n<p><span style=\"font-weight: 400;\">pip<\/span> <span style=\"font-weight: 400;\">install<\/span> <span style=\"font-weight: 400;\">-U<\/span> <span style=\"font-weight: 400;\">pip<\/span><\/p>\n<p><span style=\"font-weight: 400;\">pip<\/span> <span style=\"font-weight: 400;\">install<\/span> <span style=\"font-weight: 400;\">-e<\/span> <span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Saving into test.py, a Slack real time messaging API example<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\"># test.py<\/span><\/i><\/p>\n<p><b>import<\/b> <span style=\"font-weight: 400;\">sys<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\"># Enable debug logging<\/span><\/i><\/p>\n<p><b>import<\/b> <span style=\"font-weight: 400;\">logging<\/span><\/p>\n<p><span style=\"font-weight: 400;\">logging<\/span><b>.<\/b><span style=\"font-weight: 400;\">basicConfig(level<\/span><b>=<\/b><span style=\"font-weight: 400;\">logging<\/span><b>.<\/b><span style=\"font-weight: 400;\">DEBUG)<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\"># Verify it works<\/span><\/i><\/p>\n<p><b>from<\/b> <span style=\"font-weight: 400;\">slack_sdk<\/span> <b>import<\/b><span style=\"font-weight: 400;\"> WebClient<\/span><\/p>\n<p><span style=\"font-weight: 400;\">client <\/span><b>=<\/b><span style=\"font-weight: 400;\"> WebClient()<\/span><\/p>\n<p><span style=\"font-weight: 400;\">api_response <\/span><b>=<\/b><span style=\"font-weight: 400;\"> client<\/span><b>.<\/b><span style=\"font-weight: 400;\">api_test()<\/span><\/p>\n<h3><strong>How to use golang Slack API<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">As the first step towards how to use golang Slack API, you need to create .env file. <\/span><span style=\"font-weight: 400;\">Here is a sample code for Slack Golang API.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">package main<\/span><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">import (<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;fmt&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;os&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;time&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;github.com\/joho\/godotenv&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0&#8220;github.com\/slack-go\/slack&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">func main() {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0godotenv.Load(&#8220;.env&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0token := os.Getenv(&#8220;SLACK_AUTH_TOKEN&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0channelID := os.Getenv(&#8220;SLACK_CHANNEL_ID&#8221;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0client := slack.New(token, slack.OptionDebug(true))<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0attachment := slack.Attachment{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Pretext: &#8220;Super Bot Message&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Text:\u00a0 \u00a0 &#8220;some text&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Color: &#8220;4af030&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Fields: []slack.AttachmentField{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Title: &#8220;Date&#8221;,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Value: time.Now().String(),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0},<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0},<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0_, timestamp, err := client.PostMessage(<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0channelID,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0slack.MsgOptionAttachments(attachment),<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if err != nil {<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0panic(err)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0fmt.Printf(&#8220;Message sent at %s&#8221;, timestamp)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">}<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here is the <a href=\"https:\/\/www.bacancytechnology.com\/blog\/develop-slack-bot-using-golang\" target=\"_blank\" rel=\"noopener\">reference website<\/a> on how to use Slack go API.<\/span><\/p>\n<h3><strong>How to use Slack API PHP<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">In order to understand how to use Slack API PHP, you need build a Slack bot and API in php.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A <a href=\"https:\/\/code.tutsplus.com\/tutorials\/how-to-create-a-slack-interface-for-your-php-application--cms-25269\" target=\"_blank\" rel=\"noopener\">sample code<\/a> for creating a PHP application is elaborated below,<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;?php<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/**<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* A lightweight example script for demonstrating how to<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* work with the Slack API.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ Include our Slack interface classes<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">require_once &#8216;slack-interface\/class-slack.php&#8217;;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">require_once &#8216;slack-interface\/class-slack-access.php&#8217;;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">require_once &#8216;slack-interface\/class-slack-api-exception.php&#8217;;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">use Slack_Interface\\Slack;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">use Slack_Interface\\Slack_API_Exception;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ HELPER FUNCTIONS<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/**<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* Initializes the Slack object.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* @return Slack The Slack interface object<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">function initialize_slack_interface() {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">return null;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/**<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* Executes an application action (e.g. &#8216;send_notification&#8217;).<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* @param Slack $slack The Slack interface object<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* @param string $action The id of the action to execute<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">* @return string A result message to show to the user<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">*\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">function do_action( $slack, $action ) {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">$result_message = &#8221;;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">switch ( $action ) {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">default:<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">break;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">return $result_message;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ MAIN FUNCTIONALITY<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ Setup the Slack interface<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">$slack = initialize_slack_interface();<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ If an action was passed, execute it before rendering the page<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">$result_message = &#8221;;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">if ( isset( $_REQUEST[&#8216;action&#8217;] ) ) {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">$action = $_REQUEST[&#8216;action&#8217;];<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">$result_message = do_action( $slack, $action );<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/ PAGE LAYOUT<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/\/<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">?&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;html&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;head&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;title&gt;Slack Integration Example&lt;\/title&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;style&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">body {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">font-family: Helvetica, sans-serif;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">padding: 20px;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">.notification {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">padding: 20px;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">background-color: #fafad2;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">input {<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">padding: 10px;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">font-size: 1.2em;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">width: 100%;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">}<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/style&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/head&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;body&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;h1&gt;Slack Integration Example&lt;\/h1&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;?php if ( $result_message ) : ?&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;p class=&#8221;notice&#8221;&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;?php echo $result_message; ?&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/p&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;?php endif; ?&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;form action=&#8221;&#8221; method=&#8221;post&#8221;&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;input type=&#8221;hidden&#8221; name=&#8221;action&#8221; value=&#8221;send_notification&#8221;\/&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;p&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;input type=&#8221;text&#8221; name=&#8221;text&#8221; placeholder=&#8221;Type your notification here and press enter to send.&#8221; \/&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/p&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/form&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/body&gt;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">&lt;\/html&gt;<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h3><strong>How to use Slack API React<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Before detailing how to use Slack API react, it is crucial to understand that this method is used to add reaction or emoji to a message.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here is a Slack API react example on its usage:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The argument that you need to pass to the code are token like <\/span><span style=\"font-weight: 400;\">xxxx-xxxxxxxxx-xxxx, <\/span><span style=\"font-weight: 400;\">channel like <\/span><span style=\"font-weight: 400;\">C1234567890, <\/span><span style=\"font-weight: 400;\">name like <\/span><span style=\"font-weight: 400;\">thumbsup, <\/span><span style=\"font-weight: 400;\">timestamp like <\/span><span style=\"font-weight: 400;\">1234567890.123456.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To add base emoji with a particular skin color, here is a Slack API code example,<\/span><\/p>\n<p><span style=\"font-weight: 400;\">thumbsup::skin-tone-6<\/span><span style=\"font-weight: 400;\"> or <\/span><span style=\"font-weight: 400;\">wave::skin-tone-3<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After this particular call via the code mentioned above, the reaction is saved. Then an event is broadcast through the two types of APIs &#8211; events and RTM.<\/span><\/p>\n<p style=\"text-align: center;\"><strong>Also read:\u00a0<a href=\"https:\/\/unremot.com\/blog\/how-to-use-spotify-api\/\">How to use Spotify API; a step-by-step integration guide and full documentation list<\/a><\/strong><\/p>\n<h2><strong>Slack API pricing<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">Now coming to <a href=\"https:\/\/beta.unremot.com\/category\/slack-api\">Slack API<\/a> pricing, there are 4 plans which you can choose from. There is a free version with limited facilities like only 10 integrations only. The other Slack API plans are Pro and Business+ where the Slack legacy API costs INR 218 per month and INR 375.20 per month respectively. The last one is Enterprise Grid for which you need to contact sales team.<\/span><\/p>\n<h2><strong>Most used Slack APIs<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">In this section we will focus on the most used Slack APIs. This will provide an idea and guidance on the usage of a Slack API, and the purpose behind the use. You can then program your codes appropriately for your newly installed application.\u00a0<\/span><\/p>\n<h3><strong>Slack discovery API<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">A Slack discovery API helps to connect the Slack Enterprise Grid to the organization\u2019s enlisted partners for data loss prevention or third party e-discovery where their cloud softwares reside. This connection is used to export messages and files from slack and even act on messages, accessible to all the users.<\/span><\/p>\n<h3><strong>Slack API lookup user by email<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The method for <a href=\"https:\/\/slack.com\/api\/users.lookupByEmail\" target=\"_blank\" rel=\"noopener\">Slack API lookup<\/a> user by email is used to find an user with a particular email address. You need to enter the token and the email id as the arguments to the code and access the method using the code <\/span><span style=\"font-weight: 400;\">GET.<\/span><\/p>\n<h3><strong>Slack API reply to thread<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The <a href=\"https:\/\/slack.com\/api\/conversations.replies\" target=\"_blank\" rel=\"noopener\">Slack API reply to thread<\/a> method is used to retrieve the replies to a thread or a conversation. You need to use the conversations.replies method to achieve the desired result. The way to access the method <\/span><span style=\"font-weight: 400;\">Slack API thread<\/span><span style=\"font-weight: 400;\"> is <\/span><span style=\"font-weight: 400;\">GET.<\/span><\/p>\n<h3><strong>Slack API add user to channel<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The method for <a href=\"https:\/\/slack.com\/api\/conversations.invite\" target=\"_blank\" rel=\"noopener\">Slack API add<\/a> user to channel is conversations.invite. If the user is a member to the channel then you can add the person, the arguments being passed are the channel id and the users. The code for accessing the method is <\/span><span style=\"font-weight: 400;\">POST.<\/span><\/p>\n<h3><strong>Slack API get messages from channel<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API get messages from channel methods are used to access first the history of a Slack conversation and then extract the details of a certain message. The methods are <\/span><a href=\"https:\/\/api.slack.com\/methods\/conversations.list\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">conversations.list<\/span><span style=\"font-weight: 400;\"> API method<\/span><\/a><span style=\"font-weight: 400;\">, <\/span><a href=\"https:\/\/api.slack.com\/methods\/conversations.history\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">conversations.history<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/api.slack.com\/methods\/conversations.replies\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">conversations.replies<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><strong>Slack API create channel<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API create channel method is conversations.create which helps to create a channel be it private or public and initiate the conversations within the channel. The name of the channels can contain numbers, lowercase letters. Underscores, hyphens and must be limited to max of 80 characters.<\/span><\/p>\n<h3><strong>Slack API mention user<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slacp API mention user tag is used to call a particular user in a list in a particular message or a conversation. <\/span><span style=\"font-weight: 400;\">Slack API tag user<\/span><span style=\"font-weight: 400;\"> is used to tag using the symbol \u2018@\u2019 and select from the list or enter the name manually.<\/span><\/p>\n<h3><strong>Slack API delete message<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API delete message method is chat.delete which helps to delete a message in a conversation. If you use the method using the user token then it can delete messages which only the user is authorized to do so. And if you use the bot token then the messages accessible to the bot can only be deleted.<\/span><\/p>\n<h3><strong>Slack API read messages<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API read messages is an utility provided to retrieve the messages in a conversation or in a channel. The conversations.read method is specifically used for the purpose, where a specific message or a group of messages can be extracted.<\/span><\/p>\n<h3><strong>Slack API edit message<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API edit message method is chat.update API method. You can update any non-ephemeral message using the <\/span><span style=\"font-weight: 400;\">Slack API update message<\/span><span style=\"font-weight: 400;\"> in a particular conversation or in a channel be it private or public.<\/span><\/p>\n<h3><strong>Slack API send direct message<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API send direct message method is called chat.postMessage. By passing the channel name and the block of messages as arguments, you can send direct messages in a conversation channel. You can post an attachment as well using this method using the <\/span><span style=\"font-weight: 400;\">Slack API send message to specific user method.<\/span><\/p>\n<h3><strong>Slack API list channels<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">The Slack API lists channel method is conversations.list which helps in returning a list of channel where conversations occur in a Slack workspace. The channels returned as a response depends on the ones where the token has the access and also depends on the directives mentioned under the type parameter.<\/span><\/p>\n<h3><strong>Slack API mention channel<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">Similar to tagging and mentioning a particular user in a conversation, the Slack API mention channel method is using \u2018@\u2019. You need to select the name of the channel from the list or enter the name manually after the symbol.<\/span><\/p>\n<h3><strong>Slack API private channel<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">If you want to access a group of private channels then the Slack API private channel method groups.list can be used. It helps to retrieve all the channels to which the token has access to. If you want to initiate a conversation within a private channel then you can use the conversations API.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will discuss on how to use Slack API &#8211; a step-by-step integration guide and full documentation list. Let&#8217;s get started! Overview of Slack API Slack API grants provision to developers for creating custom applications, workflows, and data exchange both ways. The APIs provided by Slack are capable to query various types of information [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":5209,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[76],"tags":[],"class_list":{"0":"post-5204","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-technology","8":"entry"},"_links":{"self":[{"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/posts\/5204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/comments?post=5204"}],"version-history":[{"count":8,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/posts\/5204\/revisions"}],"predecessor-version":[{"id":5215,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/posts\/5204\/revisions\/5215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/media\/5209"}],"wp:attachment":[{"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/media?parent=5204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/categories?post=5204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unremot.com\/blog\/wp-json\/wp\/v2\/tags?post=5204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}