Messaging Platforms
Connect your AI assistants to multiple messaging platforms simultaneously. Incoming messages are automatically routed to the assigned assistant and responses are delivered back through the same channel.
Supported Platforms
Full conversation management, contacts, broadcasts
Facebook Messenger
Page-level inbox management
Telegram
Bot-based messaging via Telegram Bot API
Web Widget
Embeddable JavaScript widget for any website
Connecting a platform
POST /platforms/connect
Authorization: Bearer <token>
{
"platform": "messenger", // "whatsapp" | "messenger" | "telegram" | "widget"
"credentials": {
"pageId": "123456789",
"pageAccessToken": "EAAxxxxxxxx..."
},
"assistantId": "asst_abc123"
}Web widget
Create an embeddable chat widget with one API call. The widget ID is signed with a Base64 token (userId + timestamp + nonce + HMAC) for security:
POST /platforms/web-widget/create
Authorization: Bearer <token>
{
"name": "Support Widget",
"assistantId": "asst_abc123",
"theme": {
"primaryColor": "#3B82F6",
"position": "bottom-right"
},
"welcomeMessage": "Hi! How can I help you today?"
}
// Response — embed script:
{
"widgetId": "wgt_abc123",
"embedCode": "<script src='https://cdn.jsdelivr.net/npm/@cognitiondesk/widget@1/dist/widget.js' data-widget-id='wgt_abc123' data-api-key='YOUR_API_KEY' async defer></script>"
}Plan limits
Platform messaging setups typically depend on assistants and workflows. Creation of assistants, workflows, and tasks is enforced by plan limits via usage tracking. When a cap is reached, related create requests return429 until usage is reduced or the plan is upgraded.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /platforms/connect | Connect a messaging platform (WhatsApp, Messenger, Telegram, Widget) |
| POST | /platforms/disconnect | Disconnect a platform |
| GET | /platforms/status | Health status of all connected platforms |
| GET | /platforms/list | List all connected platforms |
| POST | /platforms/send-message | Send a message via any platform |
| POST | /platforms/broadcast | Broadcast to all contacts on a platform |
| POST | /platforms/configure | Configure platform webhooks |
| GET | /platforms/config/:platform | Get platform-specific configuration |
| GET | /platforms/health | Real-time health monitoring |
| GET | /platforms/analytics | Cross-platform messaging analytics |
| POST | /platforms/web-widget/create | Create an embeddable web chat widget |
| GET | /platforms/web-widget/list | List web widgets |
| PUT | /platforms/web-widget/:widgetId | Update widget configuration |
| DELETE | /platforms/web-widget/:widgetId | Delete widget |
| GET | /platforms/web-widget/:widgetId/stats | Widget usage statistics |
| GET | /platforms/assistants/list | List assistants available for platform connections |
| POST | /assistants/commands | Commands-first assistant/workflow/task operations |