GitHub adapter for chat-py
Project description
chat-adapter-github
GitHub adapter for chat-py. Python port of upstream packages/adapter-github.
Handles issue_comment and pull_request_review_comment webhooks; supports PAT, single-tenant GitHub App, and multi-tenant GitHub App auth.
Install
uv add chat-py chat-py-adapter-github chat-py-adapter-state-pg
Auth / config
Three discriminated config variants:
| Mode | Required fields | Env var fallbacks |
|---|---|---|
| PAT (personal access token) | token |
GITHUB_TOKEN |
| Single-tenant App | appId + installationId + privateKey |
GITHUB_APP_ID, GITHUB_INSTALLATION_ID, GITHUB_APP_PRIVATE_KEY |
| Multi-tenant App | appId + privateKey |
GITHUB_APP_ID, GITHUB_APP_PRIVATE_KEY |
All variants additionally accept: webhookSecret (required for signature verify), botUserId, apiUrl, logger, userName.
Minimal example
from chat import Chat
from chat_adapter_github import create_github_adapter
from chat_adapter_state_pg import create_postgres_state
bot = Chat(
user_name="mybot",
adapters={"github": create_github_adapter(
token="ghp_...", # PAT mode
webhookSecret="...",
)},
state=create_postgres_state(url="postgres://localhost/chat"),
)
@bot.on_new_mention
async def respond(thread, message):
await thread.post("On it.")
Mount bot.handle_webhook("github", body, headers) under /api/webhooks/github. The handler verifies X-Hub-Signature-256 via verify_github_signature.
Thread ID
GitHub thread IDs encode {owner}/{repo}#{issue_or_pr_number}, optionally with a comment ID for review threads.
Features
- HMAC-SHA256 webhook signature verify (
verify_github_signature) - GFM markdown rendering via
GitHubFormatConverter card_to_github_markdown/card_to_plain_textfallbacks (no native card support)- Reactions (
on_reaction) for issue comments and PR review comments
Parity notes
- No card or streaming support — GitHub comments are markdown-only. Cards degrade to GFM via
card_to_github_markdown. - Error wrapping (
handle_github_error) maps GitHub REST errors to the sharedAdapterErrorhierarchy.
Test
uv run pytest packages/chat-adapter-github
# Live
GITHUB_TOKEN=... uv run pytest packages/chat-integration-tests -k github
Upstream
https://github.com/vercel/chat/tree/main/packages/adapter-github
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chat_py_adapter_github-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chat_py_adapter_github-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa15e472d8612eb163786b3c83c4df9e0316b47617311b9696d677ad4b0c5a90
|
|
| MD5 |
22818473640e1b478d6f35ae2c7d5f14
|
|
| BLAKE2b-256 |
900c613958da8df1f4a665657a48b57d7407a4c17e6092254354d5d73a26f00e
|