The Skype Developer Platform for Web ("Skype Web SDK") is a set of JavaScript Web APIs and HTML controls that enable you to build web experiences that seamlessly integrate a wide variety of real-time collaboration models leveraging Skype for Business services and the larger Skype network. It provides support for multiple core collaboration services like presence, chat, audio, and video, enabling web experiences across a broad spectrum of users, platforms, and devices.
Today's Topic : Conversation History
One of the really nice about the Skype Web SDK is conversation history. It's not quite the persistent chat of Teams, but it does give you a better experience than the Windows client normally does. In order to enable the feature the setting must be passed when you initialize the SDK.
Skype.initialize(config).then(api => {
var app = new api.application({
settings: {
convLogSettings: true
}
});
});
Once you are up and running, you can call this block of code at any time to get more history. You can call it more than once, but the UCWA backend really does the deciding about what to send you and what not to, mostly based on the existing conversation of the SDK has in storage. What I mean by this is if you have had a conversation with user x, the SDK will return you history pertaining to user x, not some other random users that wouldn't do much good. From what I can tell it passed back 20 urls to get conversation from on each request, the 20 it believes matter most to you.
app.conversationsManager.getMoreConversations().then(() => {
console.log('done');
});
conversation.historyService.getMoreActivityItems().then(() => {
console.log('done');
});
So once you have called it you can display messages with the code below, or if you are using the the UI controls, message and call history will automatically show up the GUI for you!
// this collection has messages only: no AV call records, etc.
var messages = conv.historyService.activityItems
.filter(item => item.type() == "TextMessage");
messages.added(message => {
message.direction();
message.timestamp();
message.text();
message.html();
message.sender.id(); // SIP URI
// fetch the display name from UCWA
message.sender.displayName.get().then(name => {
console.log(name);
});
// fetch the contact photo
message.sender.avatarUrl.get().then(url => {
console.log(url);
});
// subscribe to the sender's presence status
message.sender.availability.subscribe();
message.sender.availability.changed(status => {
console.log(status);
});
});
Now for the bad news. There is really is no way to determine if a conversation is part of the history or current batch since initialization, so you'll have to use the normal logic to determine what modalities may or may not be active.
Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC,
Full Stack Developer BridgeOC Bridge Operator Console Twitter - @droutledge @ndbridge |