SMSBAT ChatHub API
ChatHub REST API manages Viber business chats, client conversations, and customer support automation workflows.
Base URL
Swagger Documentation
Interactive API documentation is available at:
Authentication
ChatHub uses a Bearer token-based authentication system with JWT tokens. Tokens can be passed in two ways:
Method 1: Authorization Header
curl -X GET https://chatapi.smsbat.com/api/company/organization \
-H "Authorization: Bearer your-jwt-token"
Method 2: X-Authorization-Key Header
curl -X GET https://chatapi.smsbat.com/api/company/organization \
-H "X-Authorization-Key: your-jwt-token"
Authentication Flow
ChatHub uses a two-level token system:
- Company Token - Organization-level access token
- Operator Token - Individual operator access token
Workflow
graph LR
A[Get Company Token] --> B[List Organizations]
B --> C[List/Add Operators]
C --> D[Get Operator Token]
D --> E[Integrate Widget]
Main Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/company/get-token |
Obtain company authorization token |
| GET | /api/company/organization |
Retrieve organization list |
| GET | /api/operator |
List operators by organization |
| POST | /api/operator/synchronize |
Add new operators |
| POST | /api/operator/status |
Change operator status |
| POST | /api/operator/get-token |
Generate operator tokens (max 24h expiration) |
| POST | /api/operator/validate-token |
Verify token validity |
Key Features
Company Token Management
Obtain and manage organization-level tokens for API access.
Organization Management
- List all organizations
- Retrieve organization details
- Manage organization settings
Operator Management
- List operators by organization
- Add new operators
- Change operator status (Active/Inactive/Deleted)
- Generate operator-specific tokens (max 24 hours)
- Validate operator tokens
Widget Integration
Integrate ChatHub widget into web applications for real-time customer support.
Quick Start
- Authentication - Get your company and operator tokens
- Organizations - Manage organizations
- Operators - Add and manage operators
- Widget Integration - Integrate chat widget
Request Format
All requests use JSON format:
Response Format
Successful responses return:
Error Handling
HTTP status codes:
200 OK- Request successful400 Bad Request- Invalid request format401 Unauthorized- Authentication failed403 Forbidden- Insufficient permissions404 Not Found- Resource not found500 Internal Server Error- Server error
Token Expiration
Tokens have an expiration time. When a token expires:
- The API will return
401 Unauthorized - Request a new token using the authentication endpoint
- Update your application with the new token
Next Steps
- Authentication - Learn how to authenticate
- Organizations - Manage organizations
- Operators - Work with operators
- Widget Integration - Integrate the chat widget