На самом деле, мы можем получить статус пользователя (онлайн / оффлайн) через Skype4Business API.Вот пример кода:
var authContext = {
id: botSetting.identifier,
username: botSetting.username,
password: botSetting.password,
domain: botSetting.domain,
_links: {},
/*1 seconds*/
messageInterval: 1000 * botSetting.messageInterval,
/*30 seconds*/
messageTimeout: 1000 * botSetting.messageTimeout,
/*3 minutes, unit in second*/
statusUpdateInterval: 1000 * botSetting.statusUpdateInterval,
AppId: null,
AppPath: null,
EndPointId: botSetting.endpointId,
Culture: botSetting.culture,
UserAgent: botSetting.userAgent,
/* default timeout to wait for user to accept message is 5 minutes */
acceptMessageInvitationTimeout: botSetting.acceptMessageInvitationTimeout * 1000,
logUnhandleEvent: botSetting.logUnhandleEvent,
RootAppUrl: null,
/*default is 30 seconds, unit in second*/
statusAwarenessInterval: (CONFIG.PROACTIVE_MESSAGE_INTERVAL_IN_SECONDS || 30) * SECOND_TO_MILLISECONDS, //30 seconds
remindProcessProactiveMsgInterval: 1000 * 60 * CONFIG.PROACTIVE_MESSAGE_REMIND_IN_MINUTES,
proactive_interval: process.env.PROACTIVE_UPDATE_INTERVAL_IN_MINUTES || 2
};
function getUserAvailibility(receiver){
var url = authContext._embedded.people._links.self.href;
var requestResourceUrl = stringFormat("{0}{1}/{2}/presence",authContext.BaseUri, url, receiver);
console.log("SkypeForBusinessBot getUserAvailibility " + receiver + " with url: " + requestResourceUrl);
return $q.nfcall(request.get, requestResourceUrl,
{ headers: authContext.headers, json: true });
}
Примечание: получатель - это электронная почта пользователя