Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blockkit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockkit

A fast way to build Block Kit interfaces in Python.

  • 1.9.2
  • PyPI
  • Socket score

Maintainers
1

Screenshot

Build status PyPI version Downloads


Blockkit is a Python library for building UI interfaces for Slack apps. It allows you to compose the interface from Python classes, so you type less, and your code becomes more maintainable.

Blockkit performs validation at runtime and provides user-friendly errors when data is invalid.

Generate

You don't even need to write code yourself. Go to https://blockkit.botsignals.co paste your JSON payload from Block Kit Builder and get corresponding Python code!

Screenshot

Installation

pip install blockkit

Usage

Start with one of the Home, Modal, or Message surface classes and follow the structure as you would follow it in JSON.

The library supports all types of surfaces, blocks, block elements, and composition objects Slack provides.

Once UI is ready, call the build() method to render components to dictionary:

from blockkit import Section, MarkdownText

Section(text=MarkdownText(text="hello world")).build()

{"type": "section", "text": {"text": "hello world", "type": "mrkdwn"}}

Here's the list of types of components and corresponding classes:

Surfaces

TypeClass
homeHome
modalModal
Message
workflow_stepWorkflowStep

Blocks

TypeClass
actionsActions
contextContext
dividerDivider
headerHeader
imageImageBlock
inputInput
rich_textRichText
sectionSection

Block elements

TypeClass
buttonButton
checkboxesCheckboxes
datepickerDatePicker
datetimepickerDatetimePicker
typeImage
multi_static_selectMultiStaticSelect
multi_users_selectMultiUsersSelect
multi_channels_selectMultiChannelsSelect
multi_conversations_selectMultiConversationsSelect
multi_external_selectMultiExternalSelect
overflowOverflow
plain_text_inputPlainTextInput
radio_buttonsRadioButtons
static_selectStaticSelect
users_selectUsersSelect
channels_selectChannelsSelect
conversations_selectConversationsSelect
external_selectExternalSelect
timepickerTimePicker
rich_text_listRichTextList
rich_text_preformattedRichTextPreformatted
rich_text_quoteRichTextQuote
rich_text_sectionRichTextSection
file_inputFileInput

Composition objects

TypeClass
plain_textPlainText
mrkdwnMarkdownText
textText
emojiEmoji
Style
Confirm
PlainOption
MarkdownOption
OptionGroup
Filter
DispatchActionConfig

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc