
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@nice-devone/nice-cxone-chat-web-sdk
Advanced tools
WebSocket
, Intl
, Promise
, EventTarget
, CustomEvent
, JSON
, Date
, crypto
, etc.)npm install @nice-devone/nice-cxone-chat-web-sdk
brandId
, channelId
)environment
)import ChatSdk, { EnvironmentName, ChatEvent, ChatEventData } from '@nice-devone/nice-cxone-chat-web-sdk';
// Initialize Chat SDK with required options
const sdk = new ChatSdk({
brandId: 123,
channelId: 'my-channel-id',
customerId: 'customer-id',
environment: EnvironmentName.EU1
});
By default, the SDK will not automatically connect to the server. You need to call the connect()
method to establish a connection.
await sdk.connect()
It will return information about the initialized channel, including feature toggle status, translations, file upload restrictions, theme color settings, and more.
await sdk.getChannelInfo()
It will return the online/offline status information for the current channel.
await sdk.getChannelAvailability()
Get or create a Thread instance:
const thread = await sdk.getThread('thread-id');
// Optionally recover a thread state (messages) from the server
const threadRecoveredData = await thread.recover();
console.log(threadRecoveredData.messages);
await thread.sendTextMessage('Message text');
thread.onThreadEvent(ChatEvent.MESSAGE_CREATED, (event: CustomEvent<ChatEventData>) => {
if (!isMessageCreatedEvent(event.detail)) {
return;
}
const message = event.detail.data.message;
console.log(message);
});
const loadMoreMessageResponse = await thread.loadMoreMessages();
console.log(loadMoreMessageResponse.data.messages);
await thread.lastMessageSeen();
Livechat channel needs to call startChat()
method first to start the chat.
Customers might end the chat by calling endChat()
method.
await thread.startChat();
Get position in queue:
sdk.onChatEvent(ChatEvent.SET_POSITION_IN_QUEUE, (event) => {
if (isSetPositionInQueuePayload(event.detail)) {
setQueuePosition(event.detail.data.positionInQueue);
}
});
const threads = await sdk.getThreadList();
const metadata = await thread.getMetadata();
await thread.archive();
await thread.setName('New thread name');
await thread.sendAttachments(fileList);
Send typing events. Can be called multiple times, for example on every keypress:
thread.keystroke();
// Optionally call stopTyping() when the user stops typing or leaves
thread.stopTyping();
Receive typing events:
// Listen for START and STOP typing events
thread.onThreadEvent(ChatEvent.AGENT_TYPING_STARTED, (event: CustomEvent<ChatEventData>) => {
// Do something with the event
});
thread.onThreadEvent(ChatEvent.AGENT_TYPING_STOPPED, (event: CustomEvent<ChatEventData>) => {
// Do something with the event
});
sdk.onChatEvent(ChatEvent.ASSIGNED_AGENT_CHANGED, (event: CustomEvent<ChatEventData>) => {
const agentName = parseAgentName((event.detail.data as AssignedAgentChangedData).inboxAssignee);
});
FAQs
Web SDK for DFO Chat
The npm package @nice-devone/nice-cxone-chat-web-sdk receives a total of 2,735 weekly downloads. As such, @nice-devone/nice-cxone-chat-web-sdk popularity was classified as popular.
We found that @nice-devone/nice-cxone-chat-web-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.