Connly Voice Feed is a JavaScript SDK that provides real-time call feed data from the Connly platform. It is compatible with both Browser and Node.js environments, enabling seamless integration of live call events, agent status updates, and callback functionalities into your applications.
You can install Connly Voice Feed using npm or yarn.
npm install connly-voice-feed
yarn add connly-voice-feed
To use Connly Voice Feed directly in the browser without a bundler, include the UMD build along with socket.io-client
:
<script src="https://cdn.jsdelivr.net/npm/socket.io-client@4.8.1/dist/socket.io.js"></script>
<script src="path/to/dist/connly-voice-feed.umd.js"></script>
import Connly from 'connly-voice-feed';
If you are using a framework like ReactJS or VueJS:
import Connly from 'connly-voice-feed';
The Connly
class is the core of the SDK, providing methods to connect to the Connly platform, subscribe to various events, and handle real-time call data.
new Connly()
Creates a new instance of the Connly SDK.
Connects to the Connly platform using the provided access token.
const connly = new Connly();
connly.start('your-access-token');
Barges into an ongoing call using the call's UUID and the supervisor's ID.
const CALL_UUID = 'example-uuid';
const SUPERVISOR_ID = 'supervisor-id';
connly.barge(CALL_UUID, SUPERVISOR_ID);
Subscribes to live call feed events.
connly.subscribeCalls();
Subscribes to ongoing call events.
connly.monitorCalls();
Subscribes to agent status and list updates.
connly.subscribeAgents();
Removes all socket event listeners.
connly.removeAllListeners();
These are callback functions that can be overridden to handle specific events emitted by the SDK.
Triggered when the socket connection is successfully established.
connly.onConnect = (data) => {
console.log('Connected to Connly platform:', data);
connly.subscribeCalls(); // Example: Subscribe to live calls once connected
};
Triggered when the socket connection is disconnected.
connly.onDisconnect = (data) => {
console.log('Disconnected from Connly platform:', data);
};
Triggered when a new call event occurs.
connly.onCalls = (data) => {
console.log('New Call Event:', data);
console.log(`Caller: ${data.from}, Agent: ${data.agent}, UUID: ${data.uuid}`);
};
Triggered when agent statuses or the agent list is updated.
connly.onAgents = (data) => {
console.log('Agent Updates:', data);
};
Triggered on status updates or errors (e.g., invalid token).
connly.onStatus = (data) => {
console.log('Status Update:', data);
};
Triggered on incoming call count updates.
connly.onCount = (data) => {
console.log('Incoming Call Count:', data);
};
Triggered when an agent answers a call.
connly.onagentAnswer = (data) => {
console.log('Agent Answered Call:', data);
};
Triggered when a customer answers a call.
connly.onAnswer = (data) => {
console.log('Customer Answered Call:', data);
};
Triggered when a callback event occurs.
connly.onCallback = (data) => {
console.log('Callback Event:', data);
};
Field | Description |
---|---|
action | Defines channel property: "ch-c" = channel created, "ch-s" = channel state change (e.g., early, answer), "ch-d" = deleted |
agent | Agent ID receiving the call |
group | Team/Group ID handling the call |
from | Customer's phone number |
id | Record ID |
inetno | Your App ID |
leguid | Customer channel UUID |
name | Customer name if previously saved |
uuid | Agent call UUID for call barging |
state | Current call state: 'early' = ringing, 'answer' = answered, 'bridged' = call established, 'hangup' = call disconnected |
- GitHub Repository: https://github.com/telecmi/connly-voice-feed
If you encounter any issues or have suggestions, please open an issue on our GitHub Issues.