All Projects β†’ nicklambourne β†’ slackblocks

nicklambourne / slackblocks

Licence: BSD-3-Clause License
🎲 Python API for Building Messages Using the Slack Block Kit API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to slackblocks

dienstplan
Slack bot app for duty rotations
Stars: ✭ 14 (-56.25%)
Mutual labels:  slack, slack-bot, slack-api
Java Slack Sdk
Slack Developer Kit (including Bolt for Java) for any JVM language
Stars: ✭ 393 (+1128.13%)
Mutual labels:  slack, slack-bot, slack-api
Slack Machine
A sexy, simple, yet powerful and extendable Slack bot
Stars: ✭ 91 (+184.38%)
Mutual labels:  slack, slack-bot, slack-api
Slacker
Slack Bot Framework
Stars: ✭ 495 (+1446.88%)
Mutual labels:  slack, slack-bot, slack-api
Slack Cli
Powerful Slack CLI via pure bash. Rich messaging, uploads, posts, piping, oh my!
Stars: ✭ 850 (+2556.25%)
Mutual labels:  slack, slack-bot, slack-api
Slack Ruby Client
A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
Stars: ✭ 957 (+2890.63%)
Mutual labels:  slack, slack-bot, slack-api
Slack Block Builder
Lightweight, no-dependency JavaScript library for creating Slack Block Kit UIs, with a builder syntax, inspired by SwiftUI.
Stars: ✭ 129 (+303.13%)
Mutual labels:  slack, slack-bot, slack-api
karmabot
upvotes and downvotes for slack
Stars: ✭ 24 (-25%)
Mutual labels:  slack, slack-bot
Yasuf
Very simple way of controlling your Python application via Slack
Stars: ✭ 23 (-28.12%)
Mutual labels:  slack, slack-bot
SlackLateX
Bot that posts posts Latex pictures
Stars: ✭ 39 (+21.88%)
Mutual labels:  slack, slack-bot
slack-mock
A Slack API mocker for Slack bot integration tests.
Stars: ✭ 61 (+90.63%)
Mutual labels:  slack, slack-bot
WebsocketClientLite.PCL
websocket Client Lite PCL - Xaramrin
Stars: ✭ 22 (-31.25%)
Mutual labels:  slack, slack-api
slack-web-api
Simple, convenient, and configurable HTTP client for making requests to Slack’s Web API. Deno port of @slack/web-api
Stars: ✭ 16 (-50%)
Mutual labels:  slack, slack-api
emojibot
Emojibot is a Slack bot that announces new custom emoji to a specific channel.
Stars: ✭ 17 (-46.87%)
Mutual labels:  slack, slack-bot
vscode-chat
Chat with your team while you collaborate over code using VS Live Share
Stars: ✭ 496 (+1450%)
Mutual labels:  slack, slack-api
slack widgets
An abstraction of the JSON structure needed to create widgets in Slack message attachments
Stars: ✭ 14 (-56.25%)
Mutual labels:  slack, slack-bot
captcha-generator
An NPM package to generate captcha images that can be used in Discord bots or various other projects
Stars: ✭ 45 (+40.63%)
Mutual labels:  slack, slack-bot
git-slack-notify
Sends Slack notifications for new commits in Git repositories
Stars: ✭ 12 (-62.5%)
Mutual labels:  slack, slack-bot
slack-php-app-framework
Robust PHP framework for building Slack apps in PHP
Stars: ✭ 29 (-9.37%)
Mutual labels:  slack, slack-bot
node-slack-events-api
Slack Events API for Node
Stars: ✭ 93 (+190.63%)
Mutual labels:  slack, slack-bot

slackblocks

PyPI - License Python Versions PyPI Downloads Build Status Coverage Status

What is it?

slackblocks is a Python API for building messages in the fancy new Slack Block Kit API.

It was created by Nicholas Lambourne for the UQCS Slack Bot because he hates writing JSON.

N.B: This is still WIP software and some of the more tricky interactive Block elements have yet to be implemented.

Requirements

slackblocks requires Python >= 3.6.

As of version 0.1.0 it has no dependencies outside the Python standard library.

Installation

pip install slackblocks

Usage

from slackblocks import Message, SectionBlock


block = SectionBlock("Hello, world!")
message = Message(channel="#general", blocks=block)
message.json()

Will produce the following JSON string:

{
    "channel": "#general",
    "mrkdwn": true,
    "blocks": [
        {
            "type": "section",
            "block_id": "992ceb6b-9ad4-496b-b8e6-1bd8a632e8b3",
            "text": {
                "type": "mrkdwn",
                "text": "Hello, world!",
                "verbatim": false
            }
        }
    ]
}

Which can be sent as payload to the Slack message API HTTP endpoints.

Of more practical uses is the ability to unpack the objects directly into the Python Slack Client in order to send messages:

from os import environ
from slack import WebClient
from slackblocks import Message, SectionBlock


client = WebClient(token=environ["SLACK_API_TOKEN"])
block = SectionBlock("Hello, world!")
message = Message(channel="#general", blocks=block)

response = client.chat_postMessage(**message)

Note the ** operator in front of the message object.

Can I use this in my project?

Yes, please do! The code is all open source and BSD-3.0 licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].