GitHunt
FA

Faylixe/slackette

A Python toolkit for implementing Slack applications

Slackette

Slackette is a modern small tooklit for building Slack applications

Examples

Use webhook to publish BlockKit messages

from slackette import SlackWebhook
from slackette.blocks import *

webhook = SlackWebhook("YOUR SLACK WEBHOOK")
webhook(
    Blocks(
        blocks=[
            Section(
                text=Markdown(text="**hello**"),
            )
        ]
    )
)

# Or simply
webhook(MarkdownBlocks(":warning: i am a lazy dude"))

Implement a interactive callback with FastAPI

from fastapi import FastAPI, Request
from pydantic import BaseSettings
from slackette.security import SlackRequest


class Settings(BaseSettings):
    SLACK_SIGNING_SECRET: str


settings = Settings()
api = FastAPI()

@api.post("/slack")
@verify_slack_signature(signing_secret=settings.SLACK_SIGNING_SECRET)
def on_interactive_event(request: Request) -> None:
    ...
Faylixe/slackette | GitHunt