Skip to content

Commit 2b7f2a0

Browse files
authored
Merge pull request #10 from chatbotkit/next
Release python-sdk
2 parents 5384a6b + 5376d5a commit 2b7f2a0

25 files changed

Lines changed: 32651 additions & 33875 deletions

‎CHANGELOG.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,58 @@ All notable changes to the ChatBotKit Python SDK are documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Unreleased]
8+
9+
## [0.6.0] - 2026-09-18
10+
11+
### Added
12+
13+
- `token=` is the new name for the API credential, on `ChatBotKit(...)`,
14+
`ClientOptions` and `extend(...)`. `secret=` is deprecated and still works;
15+
`token` wins when both are set.
16+
- `cbk.decision.create` asks a decision model typed questions (boolean,
17+
choice, score) about a state and returns an answer with probabilities for
18+
each. Pass a mapping for choice questions, as the generated `Question` type
19+
cannot hold their named options.
20+
21+
### Changed
22+
23+
- **BREAKING:** skillset ability link fields renamed. On create/update/fetch/
24+
list/export, `secretId` / `fileId` / `botId` / `spaceId` are now
25+
`linkedSecretId` / `linkedFileId` / `linkedBotId` / `linkedSpaceId`. Inline
26+
conversation `extensions.skillsets[].abilities[]` entries use
27+
`linkedSecretId` (and the new `linkedSpaceId`). GraphQL `Ability` relations
28+
`secret` / `file` / `bot` / `space` are now `linkedSecret` / `linkedFile` /
29+
`linkedBot` / `linkedSpace`. There are no compatibility aliases; upgrade
30+
together with the platform deploy.
31+
- Regenerated types also pick up unrelated API changes since the previous
32+
regeneration (2026-08-19), grouped by resource:
33+
- **BREAKING:** Dataset: `store` removed from `DatasetCreateRequest`,
34+
`DatasetFetchResponse`, `DatasetListResponseItem` and
35+
`DatasetListStreamItemData` (the platform now has a single vector store;
36+
the REST API accepts and ignores `store`).
37+
- Conversation: `expiresAt` (epoch ms, auto-delete) added to
38+
`ConversationUpdateRequest`, `ConversationFetchResponse`,
39+
`ConversationListResponseItem` and `ConversationListStreamItemData`.
40+
- Memory: `expiresAt` added to `MemoryCreateRequest`, `MemoryUpdateRequest`,
41+
`MemoryFetchResponse`, `MemoryListResponseItem` and
42+
`MemoryListStreamItemData`.
43+
- Task: `expiresAt` added to `TaskCreateRequest`, `TaskUpdateRequest`,
44+
`TaskFetchResponse`, `TaskListResponseItem` and `TaskListStreamItemData`;
45+
`resumeAt` (when a paused run resumes, null while running) added to
46+
`TaskExecutionListResponseItem` and `TaskExecutionListStreamItemData`.
47+
- Policy: `state` (`enabled` | `disabled`) added to `PolicyCreateRequest`,
48+
`PolicyUpdateRequest`, `PolicyFetchResponse`, `PolicyListResponseItem` and
49+
`PolicyListStreamItemData`.
50+
- WhatsApp integration: `appSecret` (Meta app secret for webhook signature
51+
validation, masked as `********` on read) added to
52+
`IntegrationWhatsAppCreateRequest`, `IntegrationWhatsAppUpdateRequest`,
53+
`IntegrationWhatsAppFetchResponse`, `IntegrationWhatsAppListResponseItem`
54+
and `IntegrationWhatsAppListStreamItemData`; `idempotencyKey` added to
55+
`WhatsappInitiateRequest`.
56+
- GitHub integration: `allowFrom` (allowed senders) added to
57+
`GithubIntegrationCreateRequest`.
58+
759
## [0.5.1] - 2026-07-22
860

961
### Changed

‎README.md‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
[![ChatBotKit](https://img.shields.io/badge/credits-ChatBotKit-blue.svg)](https://chatbotkit.com)
21
[![CBK.AI](https://img.shields.io/badge/credits-CBK.AI-blue.svg)](https://cbk.ai)
3-
[![Email](https://img.shields.io/badge/Email-Support-blue?logo=mail.ru)](mailto:support@chatbotkit.com)
2+
[![Email](https://img.shields.io/badge/Email-Support-blue?logo=mail.ru)](mailto:support@cbk.ai)
43
[![Discord](https://img.shields.io/badge/Discord-Support-blue?logo=discord)](https://go.cbk.ai/discord)
54
[![PyPI](https://img.shields.io/pypi/v/chatbotkit.svg)](https://pypi.org/project/chatbotkit/)
65
[![Follow on Twitter](https://img.shields.io/twitter/follow/chatbotkit.svg?logo=twitter)](https://twitter.com/chatbotkit)
@@ -39,6 +38,8 @@ This means you can focus on building great user experiences while ChatBotKit han
3938

4039
## Installation
4140

41+
Install the SDK from PyPI with pip:
42+
4243
```bash
4344
pip install chatbotkit
4445
```
@@ -96,7 +97,7 @@ from chatbotkit.types import ConversationCompleteStreamItemType
9697

9798

9899
async def main():
99-
async with ChatBotKit(secret="your-api-key") as cbk:
100+
async with ChatBotKit(token="your-api-token") as cbk:
100101
completion = cbk.conversation.complete(
101102
None,
102103
{
@@ -116,13 +117,13 @@ asyncio.run(main())
116117

117118
## SDK Client
118119

119-
Create a client with your API key and access resources as attributes:
120+
Create a client with your API token and access resources as attributes:
120121

121122
```python
122123
from chatbotkit import ChatBotKit
123124

124125
cbk = ChatBotKit(
125-
secret="your-api-key",
126+
token="your-api-token",
126127
base_url="https://api.chatbotkit.com", # optional
127128
run_as_user_id="user-id", # optional
128129
timezone="America/New_York", # optional
@@ -140,15 +141,15 @@ cbk.blueprint # Blueprint management (cbk.blueprint.resource/bulletin)
140141
cbk.task # Task management (cbk.task.execution)
141142
cbk.team # Team management
142143
cbk.space # Space management (cbk.space.storage)
143-
cbk.partner # Partner management (cbk.partner.user.token)
144+
cbk.user # User management (cbk.user.token)
144145
cbk.policy # Policy management
145146
cbk.portal # Portal management
146147
cbk.usage # Usage reporting (cbk.usage.series)
147148
cbk.magic # Magic AI generation (cbk.magic.prompt)
148149
cbk.event # Event log access (cbk.event.log)
149150
cbk.graphql # GraphQL operations
150151
cbk.channel # Channel publish/subscribe
151-
cbk.platform # Platform content (doc, example, manual, model, tutorial, ...)
152+
cbk.platform # Platform content (doc, example, manual, model, ...)
152153
cbk.integration # Integrations (widget, slack, discord, whatsapp, telegram,
153154
# messenger, instagram, notion, sitemap, support, extract,
154155
# twilio, email, mcp_server, microsoft_teams, google_chat,
@@ -290,7 +291,7 @@ Options can be passed as keyword arguments or via a `ClientOptions` instance.
290291
```python
291292
from chatbotkit import ChatBotKit, ClientOptions
292293

293-
cbk = ChatBotKit(ClientOptions(secret="your-api-key", timezone="UTC"))
294+
cbk = ChatBotKit(ClientOptions(token="your-api-token", timezone="UTC"))
294295
```
295296

296297
## Error Handling
@@ -325,7 +326,7 @@ bot = await cbk.bot.create(BotCreateRequest.from_dict({
325326

326327
## Documentation
327328

328-
- **Platform Documentation**: Comprehensive guide to ChatBotKit [here](https://chatbotkit.com/docs).
329+
- **Platform Documentation**: Comprehensive guide to the platform [here](https://docs.cbk.ai/python-sdk).
329330
- **Platform Tutorials**: Step-by-step tutorials for ChatBotKit [here](https://chatbotkit.com/tutorials).
330331

331332
## Contributing
@@ -337,7 +338,7 @@ Encounter a bug or want to contribute? Open an issue or submit a pull request on
337338
from the latest API specification, run the type sync script from the platform repo:
338339

339340
```bash
340-
pnpm --dir sites/main script:sync-types:python
341+
pnpm --dir platform/platform script:sync-types:python
341342
```
342343

343344
Install the development dependencies and run the test suite with:

‎chatbotkit/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
"Response",
1717
]
1818

19-
__version__ = "0.5.1"
19+
__version__ = "0.6.0"

‎chatbotkit/_client.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
from .contact import ContactClient
1010
from .conversation import ConversationClient
1111
from .dataset import DatasetClient
12+
from .decision import DecisionClient
1213
from .event import EventClient
1314
from .file import FileClient
1415
from .graphql import GraphqlClient
1516
from .integration import IntegrationClient
1617
from .magic import MagicClient
1718
from .memory import MemoryClient
18-
from .partner import PartnerClient
19+
from .user import UserClient
1920
from .platform import PlatformClient
2021
from .policy import PolicyClient
2122
from .portal import PortalClient
@@ -34,6 +35,7 @@ def __init__(self, options: ClientOptions | None = None, **kwargs: Any) -> None:
3435
self.bot = BotClient(self)
3536
self.conversation = ConversationClient(self)
3637
self.dataset = DatasetClient(self)
38+
self.decision = DecisionClient(self)
3739
self.skillset = SkillsetClient(self)
3840
self.file = FileClient(self)
3941
self.contact = ContactClient(self)
@@ -43,7 +45,7 @@ def __init__(self, options: ClientOptions | None = None, **kwargs: Any) -> None:
4345
self.task = TaskClient(self)
4446
self.team = TeamClient(self)
4547
self.space = SpaceClient(self)
46-
self.partner = PartnerClient(self)
48+
self.user = UserClient(self)
4749
self.policy = PolicyClient(self)
4850
self.portal = PortalClient(self)
4951
self.usage = UsageClient(self)

‎chatbotkit/_transport.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class ClientOptions:
7979
headers: Mapping[str, str] | None = None
8080
timeout: float | None = None
8181
transport: httpx.AsyncBaseTransport | None = None
82+
# @note `token` is the name to use; `secret` is its deprecated former name
83+
# and is ignored when `token` is set. It stays last so that positional
84+
# arguments keep their meaning.
85+
token: str | None = None
8286

8387

8488
class APIError(Exception):
@@ -254,6 +258,11 @@ def __init__(self, options: ClientOptions | None = None, **kwargs: Any) -> None:
254258
)
255259

256260
def extend(self, **kwargs: Any) -> Client:
261+
# @note the deprecated `secret` is folded into `token`, otherwise the
262+
# current token would win over a new credential passed as `secret`
263+
if "secret" in kwargs and "token" not in kwargs:
264+
kwargs = {**kwargs, "token": kwargs["secret"]}
265+
257266
return type(self)(replace(self.options, **kwargs))
258267

259268
async def __aenter__(self) -> Client:
@@ -431,8 +440,10 @@ def _build_headers(
431440
if has_body:
432441
result["content-type"] = "application/json"
433442

434-
if self.options.secret:
435-
result["authorization"] = f"Bearer {self.options.secret}"
443+
token = self.options.token or self.options.secret
444+
445+
if token:
446+
result["authorization"] = f"Bearer {token}"
436447

437448
if self.options.run_as_user_id:
438449
result["x-runas-user-id"] = self.options.run_as_user_id

‎chatbotkit/decision.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from __future__ import annotations
2+
3+
from typing import Any, Mapping
4+
5+
from . import types
6+
from ._transport import Client, Response
7+
8+
Request = Mapping[str, Any]
9+
10+
11+
class DecisionClient:
12+
def __init__(self, client: Client) -> None:
13+
self._client = client
14+
15+
def create(
16+
self,
17+
request: types.DecisionCreateRequest | Request,
18+
) -> Response[types.DecisionCreateResponse, Any]:
19+
"""Answers typed questions about a state.
20+
21+
Pass a mapping for choice questions: the generated ``Question`` type
22+
cannot hold the named options of their ``criteria``.
23+
"""
24+
return self._client.client_fetch(
25+
"/api/v1/decision/create",
26+
record=request,
27+
parse=types.DecisionCreateResponse.from_dict,
28+
)

‎chatbotkit/partner.py‎

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)