DataWeave Slack Library
home
DataWeave Slack Library
This library provides constructs to simplify working with Slack blocks. Types can provide guidance and validation
when you write complex block structures. Builder functions help keep code lean by eliminating all boilerplate code.
Consider this 59 line block kit JSON.
With the DataWeave Slack library, you can generate the same message with this simple script, and easily refactor the script into a dynamic one when needed:
%dw 2.0
import * from slack::Builders
output application/json
var calendar = image("https://api.slack.com/img/blocks/bkb_template_images/notifications.png", "calendar")
---
blocks([
section(text("Your next meeting is coming up:")),
divider(),
section("*Iris / Zelda 1-1*\nTuesday, January 21 4:00-4:30pm\nBuilding 2 - Havarti Cheese (3)", calendar),
context([
image("https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", "warning icon"),
mrkdwn("Will change status to *busy*")
]),
divider(),
actions([button("Cancel", "cancel-meeting") withStyle "danger"])
])
Contributions Welcome
Contributions to this project can be made through Pull Requests and Issues on the
GitHub Repository.
Before creating a pull request review the following:
When you submit your pull request, you are asked to sign a contributor license agreement (CLA) if we don't have one on file for you.
DataWeave Version
This library requires DataWeave version 2.4 or higher.
Modules
Name | Description |
---|---|
Blocks | Types that represent all Slack Blocks. |
Builders | Provides functions to simplify the creation and composition of these Slack API features: |
Elements | Representation of all Slack elements. |
Objects | Representation of all Slack objects. |