DataWeave Slack Library icon

DataWeave Slack Library

(0 reviews)
Slack Block Kit for DataWeave

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

NameDescription
BlocksTypes that represent all Slack Blocks.
BuildersProvides functions to simplify the creation and composition of these Slack API features:
ElementsRepresentation of all Slack elements.
ObjectsRepresentation of all Slack objects.


Reviews

TypeDataWeave Library
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onMar 23, 2022
Asset overview

Asset versions for 1.0.x

Asset versions
VersionActions
1.0.0