Skip to main content

kiarina-lib-slack

PyPI version Python License: MIT

English | 日本語

Dependencies

Package Version License
Pydantic Settings >=2.10.1 MIT
pydantic-settings-manager >=3.2.0 MIT

A Slack SDK is not included as a dependency. Add one to the application that creates the Slack client.

Installation

pip install kiarina-lib-slack

Features

  • Configuring a Slack App Store Slack app credentials, OAuth scopes, and workspace information.
  • Managing Multiple Apps Switch between named settings for multiple Slack apps.
  • Loading Environment Variables Load environment variables with the KIARINA_LIB_SLACK_ prefix.
  • Using Socket Mode Store an app-level token for Socket Mode.
  • Protecting Secrets Store client secrets, signing secrets, and tokens as SecretStr.

Configuring a Slack App

app_id, client_id, client_secret, and signing_secret are required.

from kiarina.lib.slack import SlackSettings

settings = SlackSettings(
    app_id="A0123456789",
    client_id="123456789.123456789",
    client_secret="client-secret",
    signing_secret="signing-secret",
    bot_token="xoxb-...",
    scopes=["chat:write"],
)

Managing Multiple Apps

settings_manager uses multiple-settings mode. Place named settings under configs.

kiarina.lib.slack:
  default: production
  configs:
    development:
      app_id: A_DEVELOPMENT
      client_id: development-client
      client_secret: development-secret
      signing_secret: development-signing-secret
    production:
      app_id: A_PRODUCTION
      client_id: production-client
      client_secret: production-secret
      signing_secret: production-signing-secret
import yaml
from pydantic_settings_manager import load_user_configs

from kiarina.lib.slack import settings_manager

with open("config.yaml", encoding="utf-8") as file:
    load_user_configs(yaml.safe_load(file) or {})

settings = settings_manager.get_settings("production")

Loading Environment Variables

Set the scopes list as a JSON array.

export KIARINA_LIB_SLACK_APP_ID="A0123456789"
export KIARINA_LIB_SLACK_CLIENT_ID="123456789.123456789"
export KIARINA_LIB_SLACK_CLIENT_SECRET="client-secret"
export KIARINA_LIB_SLACK_SIGNING_SECRET="signing-secret"
export KIARINA_LIB_SLACK_SCOPES='["chat:write"]'
from kiarina.lib.slack import SlackSettings

settings = SlackSettings()

Using Socket Mode

For Socket Mode, set an xapp- token as app_token.

settings = SlackSettings(
    app_id="A0123456789",
    client_id="123456789.123456789",
    client_secret="client-secret",
    signing_secret="signing-secret",
    app_token="xapp-...",
)

Protecting Secrets

Extract secret values only where they are passed to an SDK.

bot_token = (
    settings.bot_token.get_secret_value()
    if settings.bot_token is not None
    else None
)

API Reference

kiarina.lib.slack

from kiarina.lib.slack import (
    SlackSettings,
    settings_manager,
)

SlackSettings

class SlackSettings(BaseSettings):
    def __init__(
        self,
        *,
        app_id: str,
        client_id: str,
        client_secret: SecretStr,
        signing_secret: SecretStr,
        app_token: SecretStr | None = None,
        scopes: list[str] = [],
        team_id: str | None = None,
        enterprise_id: str | None = None,
        bot_token: SecretStr | None = None,
    ) -> None: ...

Slack app settings.

Fields

  • app_id (str): Slack app ID.
  • client_id (str): Slack OAuth client ID.
  • client_secret (SecretStr): Slack OAuth client secret.
  • signing_secret (SecretStr): Slack request signing secret.
  • app_token (SecretStr | None): App-level token for Socket Mode.
  • scopes (list[str]): OAuth scopes requested by the Slack app.
  • team_id (str | None): Slack workspace ID.
  • enterprise_id (str | None): Slack Enterprise Grid organization ID.
  • bot_token (SecretStr | None): Slack bot user OAuth token.

settings_manager

settings_manager: SettingsManager[SlackSettings]

Global instance that manages named Slack app settings.

Metadata

Release files for kiarina-lib-slack 2.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kiarina-lib-slack 2.3.1
File Size Uploaded Provenance Actions
kiarina_lib_slack-2.3.1.tar.gz 5.6 kB With provenance Details for kiarina_lib_slack-2.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kiarina-lib-slack 2.3.1
File Interpreter ABI Platform Actions
kiarina_lib_slack-2.3.1-py3-none-any.whl Python 3 none any Details for kiarina_lib_slack-2.3.1-py3-none-any.whl

Total release size: 9.9 kB

Release files / kiarina_lib_slack-2.3.1.tar.gz

Download URL kiarina_lib_slack-2.3.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
44fae230bb19c73419d262d0d1626292e7ff9a5e731155fb89b7df1e29d05b0c
BLAKE2b-256 checksum
How to use checksums
6d7baebf8b0092f3339d8bac298ae670a6a9c59560ee6c5368e69ccf394ceb92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / kiarina_lib_slack-2.3.1-py3-none-any.whl

Download URL kiarina_lib_slack-2.3.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f7dd0a70076faedbcc1497fcbd4ec47674d11335814b68653fcd7b8fd3580bd
BLAKE2b-256 checksum
How to use checksums
21820b73002f42c55298d0365fa44406853be536bd943017a67cae88f119f234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Security for kiarina-lib-slack 2.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kiarina_lib_slack-2.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page