Skip to main content

A fast, Pythonic API wrapper for Google Chat webhooks.

Project description

Chatapult Banner

Chatapult

A fast, Pythonic API wrapper for Google Chat webhooks.

Chatapult is designed to make sending automated notifications, CI/CD alerts, and rich UI cards to Google Workspace Spaces effortless. Whether you need a simple synchronous alert or a high-throughput async notification integration, Chatapult handles the boilerplate so you can focus on your application.

Coverage License: MIT Code style: black

Features

  • Zero Boilerplate: Send a message to a Google Chat Space in three lines of code.
  • Async Ready: First-class support for asyncio, making it perfect for FastAPI, Discord bots, and high-concurrency event loops.
  • Rich V2 Cards (Coming Soon): Construct complex Google Chat Cards and Widgets using clean Python objects instead of nested JSON.
  • Threaded Replies: Easily group related alerts by replying to specific message threads.
  • Fully Typed: Built with standard Python type hints for excellent IDE autocomplete and static checking.

Installation

Install via pip:

pip install chatapult

Quick Start

Security Note: Never hardcode your webhook URLs. Always load them securely from environment variables or a secrets manager.

Synchronous Usage

Perfect for simple scripts, cron jobs, or basic data pipelines.

import os
from chatapult import ChatClient, APIError

webhook_url = os.environ.get("GOOGLE_CHAT_WEBHOOK_URL")

try:
    with ChatClient(webhook_url) as client:
        response = client.send_message("Hello from Chatapult!")
        print("Message sent successfully!")
except APIError as e:
    print(f"Failed to send message: {e}")

Asynchronous Usage

Ideal for web servers, async task queues, or applications where you cannot block the main thread.

import asyncio
import os
from chatapult import AsyncChatClient, NetworkError

async def main():
    webhook_url = os.environ.get("GOOGLE_CHAT_WEBHOOK_URL")

    try:
        async with AsyncChatClient(webhook_url) as client:
            await client.send_message("Hello from the async event loop!")
            print("Async message sent successfully!")
    except NetworkError as e:
        print(f"Network issue encountered: {e}")

if __name__ == "__main__":
    asyncio.run(main())

Advanced Usage

Documentation for sending V2 Cards, threaded replies, and handling rate-limit exceptions will be added here as features are released.

Contributing

Contributions are welcome! If you'd like to help improve Chatapult, please review our Contributing Guidelines and open an issue or pull request.

License

This project is licensed under the MIT License - see LICENSE for details.

Project details


Download files

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

Source Distribution

chatapult-0.1.0.tar.gz (818.2 kB view details)

Uploaded Source

Built Distribution

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

chatapult-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file chatapult-0.1.0.tar.gz.

File metadata

  • Download URL: chatapult-0.1.0.tar.gz
  • Upload date:
  • Size: 818.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for chatapult-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7739d9978b6996d89e09fb18157dd57c6c3ae9da479e98d8c77fce047db321fc
MD5 41a8938d3057be89c546c622aacf7ee5
BLAKE2b-256 54b38fa5ce20088e9eb059137f09351f10955d64cca86b7448584bc46060666c

See more details on using hashes here.

File details

Details for the file chatapult-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chatapult-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for chatapult-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34d821014d672244be19efcb131b3598375ee8d16a4ada981153d552441fd226
MD5 5fc67dcd43de4700d4aba6ef97fb48c1
BLAKE2b-256 f7043f67a41b5ce7c3d74c712a27db5063c8788532be16c1b7623103a1d1dfb9

See more details on using hashes here.

Supported by

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