Official Python client for the FluidTalk Handshake API — drop FluidTalk AI persona replies into your own chatbot backend.
Project description
fluidtalk (Python)
Official Python client for the FluidTalk Handshake API. Drop FluidTalk's AI persona replies into your own chatbot backend without rebuilding the HTTP/auth/multipart layer.
You keep your own orchestration (when to open a chat, when to follow up, where to send messages); this client just gives you the persona's reply in one call.
pip install fluidtalk
from fluidtalk import FluidTalk, FluidTalkError
ft = FluidTalk(
api_key="ft_sk_...", # scoped to one persona + engine
own_username="@my_account", # optional default for tracking / dedup
# base_url="https://api-talk.fluidvip.com" (default)
)
# A lead messaged you -> get the persona's reply and relay it on your platform
res = ft.inbound_chat(target="@john_doe", message="hey, saw your post!")
for bubble in res.replies:
my_chat.send("@john_doe", bubble)
if res.should_send_photo and res.photo_url:
my_chat.send_image("@john_doe", res.photo_url)
Concepts → methods
A conversation can start four ways. The builder names map to these methods (the API wire value is handled for you):
| Builder name | When | Method |
|---|---|---|
| Inbound Chat | the lead messages first (or an ongoing chat) | ft.inbound_chat(target, message) |
| AI Opener | your persona messages first | ft.ai_opener(target) |
| Event Trigger | a platform event fires | ft.event_trigger(target, event_type, context) |
| Follow-up | re-engage a quiet lead | ft.follow_up(target) |
| — | host a local image for context | ft.upload_image(path=...) |
A conversation is keyed by (persona, target) — reuse the same target for the same lead and the engine keeps phase/state across turns.
Examples
# AI opener (optionally with a profile screenshot for better targeting)
opener = ft.ai_opener(target="@lead", image_path="./profile.jpg")
my_chat.send("@lead", opener.message)
# Platform event (event_type must match an Event Trigger configured in your engine)
ev = ft.event_trigger(target="@lead", event_type="story_reaction", context={"reaction": "🔥"})
# Re-engage a ghost (needs an existing conversation)
fu = ft.follow_up(target="@lead")
# Attach an image the lead sent
url = ft.upload_image(path="./incoming.jpg").url
r = ft.inbound_chat(target="@lead", message="what do you think?", image_url=url)
Results: inbound_chat → ChatResult(reply, replies, should_send_photo, photo_url, session_id, ignored, ignore_reason); ai_opener/event_trigger/follow_up → ActionResult(session_id, message, ignored, ignore_reason); upload_image → UploadResult(url). Send replies as separate bubbles; when should_send_photo, also send photo_url.
Behaviour to handle
try:
res = ft.inbound_chat(target="@lead", message="hi")
if res.ignored:
return # duplicate lead, already owned by another account — send nothing
for bubble in res.replies:
my_chat.send("@lead", bubble)
except FluidTalkError as e:
if e.status == 402: # out of tokens (insufficient_tokens)
...
elif e.status == 400: # conversation already DONE / sealed -> stop messaging
...
elif e.status == 404: # no conversation yet (follow_up before any contact)
...
- One token per conversation — starting a new conversation costs one token; out of tokens →
FluidTalkError(status=402). - Sealed conversation — when finished, the next
inbound_chatraisesFluidTalkError(status=400)("This session is DONE").
API keys are action-only: send messages and upload images, never change personas/engines/billing (that stays in the dashboard). Keep your ft_sk_ key secret.
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
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 fluidtalk-1.0.1.tar.gz.
File metadata
- Download URL: fluidtalk-1.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbeed2a23b8399b59bc62408a994eb44c3b8cb396582eeb9c052a1073473aad4
|
|
| MD5 |
d901ae897ff7e83b29e348550d2f3298
|
|
| BLAKE2b-256 |
7e8715dd6c0bc82b765e711388ea265d2eb2152b83da219bb05534bca62c820d
|
File details
Details for the file fluidtalk-1.0.1-py3-none-any.whl.
File metadata
- Download URL: fluidtalk-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7fa1555917be375c94df1fc758a957073294db377a79a8eba5a2ca54c69d383
|
|
| MD5 |
08f06ff2e5becb6c89e5f47f4c5b8b6e
|
|
| BLAKE2b-256 |
4f8bbb884c9df34cd5b1fff71eb72947100af17301925f34f6d6cab921125afd
|