For Developers · SDK
React Native SDK
Native widget component and hook for React Native. No DOM — uses React Context instead of window.fluxchatContext.
Overview
This SDK does not exist yet — you can build it. Use the JS/TypeScript SDK as the reference implementation. The API is identical for all languages — only the syntax changes.
API reference
Ask endpoint
ask.http
POST https://dev-api.fluxchat-corp.com/api/v2/public/bot/ask
Content-Type: application/json
X-API-Key: fc_prod_your_key
{
"message": "What are your opening hours?",
"context": "User: Alice, Plan: Pro", // optional — highest priority
"conversationId": "" // optional — omit for stateless
}
// Response
{
"success": true,
"data": {
"reply": "We are open Mon–Fri 9am–6pm.",
"conversationId": "conv-uuid",
"intent": null,
"confidence": 1
}
}Test key
test-key.http
GET https://dev-api.fluxchat-corp.com/api/v2/public/bot/test
X-API-Key: fc_prod_your_key
// Response
{ "success": true, "data": { "organizationId": "org-uuid", "scopes": ["bot:read"] } }Knowledge base
kb.http
// Create (requires bot:write scope)
POST /api/v2/organizations/{orgId}/knowledge-base
Authorization: X-API-Key fc_prod_your_key
{ "title": "FAQ", "content": "...", "category": "general", "keywords": ["faq"] }
// Update
PATCH /api/v2/organizations/{orgId}/knowledge-base/{id}
{ "content": "Updated content" }
// Delete
DELETE /api/v2/organizations/{orgId}/knowledge-base/{id}
// List / Get (requires JWT admin token)
GET /api/v2/organizations/{orgId}/knowledge-base
GET /api/v2/organizations/{orgId}/knowledge-base/{id}Usage example — what the SDK should look like
example.tsx
import { FluxChatWidget, FluxChatProvider } from '@fluxchat_sdk/react-native';
// Wrap your app
export default function App() {
return (
<FluxChatProvider apiKey={process.env.EXPO_PUBLIC_FLUXCHAT_KEY!}>
<YourApp />
<FluxChatWidget />
</FluxChatProvider>
);
}ask.tsx
// Headless — use the hook directly
import { useFluxChat } from '@fluxchat_sdk/react-native';
function SupportScreen() {
const { ask, messages, loading } = useFluxChat();
const handleSend = async (text: string) => {
await ask({ message: text, context: 'User: Alice' });
};
}Implementation checklist
Every SDK must implement these features at minimum. Use the TypeScript types in src/types.ts as the reference.
| Method | Auth | Description |
|---|---|---|
| ask(message, context?, conversationId?) | API key | Send a message, return reply + conversationId |
| testKey() | API key | Verify the key, return organizationId + scopes |
| knowledge.create(title, content, ...) | API key (bot:write) | Add a knowledge base article |
| knowledge.update(id, patch) | API key (bot:write) | Update a KB article |
| knowledge.delete(id) | API key (bot:write) | Delete a KB article |
| knowledge.list() | JWT (admin) | List all KB articles |
| knowledge.get(id) | JWT (admin) | Get one KB article |
| Error types | — | ApiError, NetworkError, ConfigError with status code |
Expected file structure
structure
sdk/react-native/
├── README.md
├── package.json
├── src/
│ ├── FluxChatWidget.tsx # floating chat bubble (native UI)
│ ├── FluxChatProvider.tsx # context provider
│ ├── useFluxChat.ts # headless hook
│ └── types.ts # AskResponse, Message, etc.
└── __tests__/
└── useFluxChat.test.tsHow to contribute
Comment on the GitHub issue to claim it, then follow these steps:
terminal
# 1. Fork on GitHub, then clone
git clone https://github.com/YOUR_USERNAME/fluxchat-sdk.git
cd fluxchat-sdk
# 2. Create your branch
git checkout -b sdk/react-native
# 3. Add your SDK under sdk/react-native/
mkdir -p sdk/react-native
# 4. Implement the checklist, add tests, write a README
# 5. Push and open a PR against main
git push origin sdk/react-native