Skip to main content

kobil-chat

KOBIL Chat (Mercury) client for Python, with automatic OAuth token management.

pip install kobil-chat
from kobil.chat import ChatClient

chat = ChatClient(
    chat_base_url="https://idp.cloud.kobil.com/auth/realms/{TENANT}/mpower/v1/users/{USER_ID}",
    tenant_name="acme",
    token_auth_mode="basic",  # chat token endpoint may require Basic auth
    media_download_url="https://idp.cloud.kobil.com/v1/mpower/tenants/{TENANT}/media/{MEDIA_ID}/download",
    # credentials optional if KOBIL_* env vars are set
)

chat.send_text(user_id, "Hi!", title="Update")
chat.send_choice(user_id, "Continue?", ["Yes", "No"])
chat.send_smart_screen(user_id, "Opening…", "service_client_id")
chat.send_attachment(user_id, open("a.pdf", "rb").read(), file_name="a.pdf", text="Please review")
data = chat.get_attachment_file(media_id)  # bytes

{TENANT} is filled from tenant_name, {USER_ID} from the call, {MEDIA_ID} from get_attachment_file. Send operations return {"messageId": ..., "instanceId": ...}. Failures raise kobil.chat.KobilChatError.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kobil_chat-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file kobil_chat-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: kobil_chat-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for kobil_chat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8703053a1557b70a395bc4efb06d22966cc1008181eb9837410cccc57d630c4d
MD5 5f67250ad41e90aac7acd3839a7d7ec1
BLAKE2b-256 10b0afd981308b95f1711229f083e35916b634dcf965e597b3011c4bd755decb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page