Jsonnet Blocks
A detailed look at Courier Jsonnet Block functionality, use cases and best practices.
Availability: Slack, Microsoft Teams
Jsonnet Blocks enable you to create dynamic, customized content for Slack and Microsoft Teams notifications using the Jsonnet templating language.
Jsonnet is a JSON to JSON templating language, which means that combining Jsonnet with your user data allows you to build and send dynamic, custom Slack blocks and MS Teams Adaptive Cards in your notifications.
New Jsonnet Block
Key Features
Data Integration
- Access user data using the
data("variable")
syntax - Dynamically populate message content based on user attributes or event data
Templating
- Use Jsonnet’s templating features to create reusable components
- Apply conditional logic to show or hide parts of your message
Platform-Specific Elements
- Create Slack Block Kit elements
- Design Microsoft Teams Adaptive Cards
Courier-Provided Templates
Courier offers several pre-built Jsonnet template blocks for common Block Kit actions:
- Buttons
- Dropdowns
- Images
- Text sections
- And more…
These templates can serve as starting points for your custom designs.
Custom Block Kit Elements
You can also build your own Block Kit elements from scratch. The Jsonnet Block expects either a single Block Kit element or an array of elements.
Demo: Designing Slack Notifications using Block Kit and Jsonnet
Watch this video tutorial to see Jsonnet Blocks in action: