{"id":110749,"date":"2016-09-22T08:23:49","date_gmt":"2016-09-22T15:23:49","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/slash-commands\/"},"modified":"2016-09-22T08:23:49","modified_gmt":"2016-09-22T15:23:49","slug":"slash-commands","status":"publish","type":"power-automate","link":"https:\/\/www.microsoft.com\/en-us\/power-platform\/blog\/power-automate\/slash-commands\/","title":{"rendered":"Walkthrough: Using the Request trigger to create Slack custom commands"},"content":{"rendered":"
On Microsoft Flow we recently released the Request<\/em><\/strong> feature, that allows you to trigger a flow run by calling a specific HTTP endpoint. As part of this walkthrough, we are going to look at how to use this new trigger to create a Slack custom command that posts the latest XKCD<\/u><\/a> comic strip in your slack channel. The walkthrough has two aspects: 1. Setting up the flow and 2. Configuring a Slack custom command<\/p>\n To start off, head on to My Flows<\/u><\/a> page, and click on the \u201cCreate from blank<\/em><\/strong>\u201d button in the top right corner.<\/p>\n<\/li>\n Search and select the Request trigger. It should look like as shown below<\/p>\n<\/li>\n<\/ul>\n <\/p>\n Now we need to get the XKCD comic strip, for this we are going to use the HTTP action. You can add the HTTP<\/em><\/strong> action by clicking \u201c+New Step\u201d, then click on \u201cAdd an action\u201d and search for HTTP<\/em><\/strong> in the search box.<\/p>\n<\/li>\n Set the method to \u201cGET\u201d<\/em><\/strong> and URI to http:\/\/xkcd.com\/info.0.json<\/em><\/strong><\/p>\n<\/li>\n<\/ul>\n <\/p>\n Finally, we need to setup the response action \u2013 this action always need to be used in conjunction with the Request<\/em><\/strong> action, as it is used to define the response to the incoming request.<\/p>\n<\/li>\n You can add the Response<\/em><\/strong> action by clicking \u201c+New Step\u201d, then click on \u201cAdd an action\u201d and search for Response<\/em><\/strong> in the search box.<\/p>\n<\/li>\n Paste in the response body provided, use the \u201cstatus code<\/em><\/strong>\u201d token from the HTTP action and create the flow.<\/p>\n<\/li>\n<\/ul>\n Response body:<\/p>\n \u00a0<\/p>\n <\/p>\n <\/p>\n Head over to the home page on your Slack team – https:\/\/<teamName>.slack.com\/home.<\/p>\n<\/li>\n Under Applications, navigate to Slash commands and click on Add Configuration<\/p>\n <\/p>\n<\/li>\n Provide a name for your Slash Command, I used \/xkcd for mine.<\/p>\n<\/li>\n In the URL field paste in the URL that you coped from the Request trigger from Flow.<\/p>\n<\/li>\n Make sure the Method is set to POST.<\/p>\n<\/li>\n<\/ul>\n <\/p>\n Once you have saved the integration, go over to the Slack and type in \/xkcd, you should see the latest comic strip show up in seconds.<\/p>\n<\/li>\n<\/ul>\n <\/p>\n We\u00a0hope this tutorial\u00a0was helpful and\u00a0are excited to see how you will use this feature to build\u00a0new and interesting flows. For questions or feedback reach out to us on Twitter\u00a0<\/u><\/a>or on the forums.<\/p>\n \u00a0<\/p>\n \u00a0<\/p>\n","protected":false},"excerpt":{"rendered":" Learn how to create Slack custom commands with Microsoft Flow in minutes. <\/p>\n","protected":false},"author":131,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","power-automate-category":[2590,2836],"power-automate-tag":[],"coauthors":[2134],"class_list":["post-110749","power-automate","type-power-automate","status-publish","hentry","power-automate-category-flow-of-the-week","power-automate-category-walkthroughs"],"yoast_head":"\nPart 1: Setting up the flow<\/h2>\n
\n
\n
\n
{<\/code><\/p>\n
\u00a0 \"text\": \"@actions('HTTP').outputs.body.safe_title\",<\/code><\/p>\n
\u00a0 \"attachments\": [<\/code><\/p>\n
\u00a0\u00a0\u00a0 {<\/code><\/p>\n
\u00a0\u00a0\u00a0\u00a0\u00a0 \"image_url\": \"@actions('HTTP').outputs.body.img\",<\/code><\/p>\n
\u00a0\u00a0\u00a0\u00a0\u00a0 \"text\": \"@actions('HTTP').outputs.body.alt\",<\/code><\/p>\n
\u00a0\u00a0\u00a0\u00a0\u00a0 \"footer\": \"Microsoft Flow\",<\/code><\/p>\n
\u00a0\u00a0\u00a0\u00a0\u00a0 \"footer_icon\": \"https:\/\/procsi.blob.core.windows.net\/blog-images\/icon_Flow_167x167.png\"<\/code><\/p>\n
\u00a0\u00a0\u00a0 }<\/code><\/p>\n
\u00a0 ],<\/code><\/p>\n
\u00a0 \"response_type\": \"in_channel\"<\/code><\/p>\n
}<\/code><\/p>\n
Important: Copy the URL in the Request trigger. You may have to close and re-open the flow to get this URL.<\/h3>\n
Part 2: Configure a Slack custom command<\/h2>\n
\n
\n