Tutorial: Building more contextual search command results with Block Kit

Take advantage of the new Block Kit elements to send a more contextual message

Tomomi Imura
Slack Platform Blog
2 min readApr 17, 2019

--

We’ve just released Block Kit, a UI framework that enables you to build rich and interactive experiences in Slack. Block Kit consists of stackable blocks that you can mix and match to build a message, giving your apps more options to display information in each message. You can prototype with the Block Kit Builder, a visual tool, as well as actually build messages sent by your app using the JSON string generated by the tool.

In this tutorial, we’ll take advantage of the new Block Kit elements to send a more contextual message and improve the user experience of search results in your app. We’ll use a restaurant app as our sample, and we’ll create a slash command where a user can send the /find-food command to get a list of a few restaurants as the result.

Use Block Kit to create a Slash Command result like this!

Once you’ve mastered the creation of rich messages in response to slash commands, you’ll learn how to send messages to a channel using incoming webhooks, via the Web API using chat.postMessage and chat.postEphemeral, and post in response to message actions and rich interactions.

To build your own app using Block Kit, read the entire tutorial and follow the step-by-step tutorial on Slack API Tutorial page!

Feedback? Questions? Drop us a note at devsupport@slack.com or tweet us @SlackAPI.

--

--

Tomomi Imura
Slack Platform Blog

👩‍💻 Open Web & Tech Advocate. 🍩 Creative Technologist. 🦄 All things JavaScript. 🐱-as-a-Service. 🥑 Developer Advocate at Slack.