+ Start a Discussion
Daniel B ProbertDaniel B Probert 

getunreadcount in Community Returning 0

I am trying to build a simple live notification lightning component for when a new private message is received. That way when you're on the community you don't rely on having to click into messages to see there is a new message.

My problem is that always returns a value of 0

public class CAMAComm_Notifications {
    public static integer getUnreadCount(){
        ConnectApi.UnreadConversationCount unreadMessageCount = ConnectApi.ChatterMessages.getUnreadCount();
		Integer numberOfUnreadMessages = unreadMessageCount.unreadCount;
        return numberOfUnreadMessages;

my lightning cmp:
<aura:component implements="forceCommunity:availableForAllPageTypes" controller="CAMAComm_Notifications" access="global" >
    <aura:attribute name="unreadmessagecount" type="Integer"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    		<div class="slds-notify_container">
  				<div class="slds-notify slds-notify--alert slds-theme--success" role="alert" style="position: inherit !important;">
	    			<span class="slds-assistive-text">Success</span>
    				<p>{!v.unreadmessagecount} unread messages</p>

my controller js
    doInit : function(component, event, helper) {
        helper.messageCountpoller(component, event, helper);

my helper js
    messageCountpoller : function(component, event, helper) { 
        //execute callApexMethod() again after 5 sec each
            $A.getCallback(function() { 
            }), 5000
    handleResponse : function (response, component){
        var retVal = response.getReturnValue();
        console.log('Number of Messages: ' + retVal);
    callApexMethod : function (component,helper){    
        var action = component.get("c.getUnreadCount");        
        action.setCallback(this, function(response) {
            this.handleResponse(response, component);
from everything i can see this is in line with the documentation for the getUnreadCount() however it will never display anything but 0.

are private messages not supported using this method? If not how else can I do it?