Example of a reply back to the initial Slack Slash commandĪlternatively you can use blocks to initiate a rich formatted message.Want some recommendations on what apps to install for your Slack team? Check out our blog post 14 Best Slack Apps for Productivity to Help Your Team Work More Effectively. To send a message back, configure a POST request to this unique URL and define a text property to send a simple text response back to the user that initiated this command on Slack. So after you add steps to your workflow to perform a database query, or send some API calls to another service, you'll want to send feedback to Slack with a message. This URL is unique to this message, it allows an asynchronous reply to the slash command. An example of a response_url within a Slack slash command HTTP request You'll notice in the body of the payload from Slack, there's a special response_url parameter. Sending a reply asynchronously with response_url Your webhook will respond instantly with an empty body, giving you time to send a reply later. To configure your Pipedream HTTP webhook's initial response, just click the Configure button on the trigger and select 204 No Content default response.Ĭonfigure your HTTP webhook to use the 204 No Content response This gives us up to 5 minutes to reply to the Slash Command query, plenty of time to perform actions like querying a database or another API. ![]() Instead, if you send an 200 level response with no content, Slack will interpret this as a signal to wait on the reply. ![]() However, it needs to be fast and synchronous with that method. Configuring the HTTP responseīy default, the response to Slack's Slash Command webhook request will render as the reply in Slack. Once you have the Slash command definition saved and have installed your app in your workspace, now we can develop the workflow to actually perform actions or queries. Slack will automatically send an HTTP request every time your slash command is triggered. Example of a populated Slash Command using Pipedream as the HTTP webhook On Pipedream create a new HTTP triggered workflow, and then just copy and paste the unique URL into the Slack Slash Command definition. Connecting the Slack Command to a Pipedream workflow Open this link to start to define a new Slash Command, give it a name and some expected parameters. Then, on the left hand side you'll see a Slash Commands navigation link. Getting Startedįirst you'll need to start a new Slack App if you haven't already. They're portable too, so if you're away from your computer, just open Slack on your mobile device and still be able to trigger a slash command. Slack Slash commands are great small shortcuts to perform actions or queries quickly. ![]() `/remind me in 2 hours to swap out the laundry`Ī Slack bot will interpret the command, and display some feedback: What are the benefits of using slash commands? You can use this command to schedule a reminder for yourself right in Slack: A great example is the /remind slash command on Slack. Slash commands are pre-defined actions on Slack to trigger a query or an action. In this Speed Run episode, we'll show you how to build a Slack Slash command with a Pipedream workflow in less than 10 minutes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |