function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Fota MadalinaFota Madalina 

I receive an empty list of notifications using the Connect REST API endpoint: /connect/notifications

Hello everyone,
 
I want to get all the current user's notifications to display them in a LWC component. For this, I tried to make a REST API callout from Salesforce to the same Salesforce org using Connect REST API Resources (/connect/notifications — documentation: https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_notifications_resources.htm)
I tried to make the callout using first Workbench, then an apex class, but I always get the same result, an empty list of notifications. The current user has both custom and standard notifications, so I don't understand why I always get an empty list.
 
Does anyone have any idea why I receive an empty list of notifications?
User-added imageUser-added image
Maharajan CMaharajan C
Hi Fota,

Even it tried the same in workbecnch but it's not coming. May be due to Workbench connected apps...we are facing this restriction.

But when i am running the below code in developer console Anonymous window am getting the connect nottification in debug logs. So you can try the below code in you LWC Component to fetch the Connect Notifications.
 
String sfdcURL = URL.getOrgDomainUrl().toExternalForm(); 
String restAPIURL = sfdcURL + '/services/data/v51.0/connect/notifications';
HttpRequest httpRequest = new HttpRequest();  

httpRequest.setMethod('GET');

httpRequest.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
httpRequest.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); 
httpRequest.setEndpoint(restAPIURL);  
String response = '';
try {  
    Http http = new Http();   
    HttpResponse httpResponse = http.send(httpRequest);  
    if (httpResponse.getStatusCode() == 200 ) {  
        response = JSON.serializePretty( JSON.deserializeUntyped(httpResponse.getBody()) );  
   		system.debug(' Connect Notifications---> ' + response);
    }
} catch( System.Exception e) {  
    System.debug('ERROR: '+ e);  
}

Thanks,
Maharajan.C

 
Fota MadalinaFota Madalina
Hi Maharajan C,
The code given by you works but only returns custom notifications (the second notification in my screenshot above). Do you know any way to get standard notifications as well?
bhfgdng fgdhbgfbhfgdng fgdhbgf
This issue is now very commen you need to learn some basic steps about REST API endpoint just visit here (https://lnd.achievegroup.asia/softskills) and learn about it.
covore7855 covore7855covore7855 covore7855
World Live News (https://www.worldlive.news/" style="color:blue; text-decoration:underline) Today's Top International News Headlines, news on politics, Business, Crime, Sports and Current World News: Get Latest and breaking information from World.
 
fdsgfd ggfdhbfdsgfd ggfdhb
The main thing that we all know is the endpoints determination in a correct way you can see here (https://www.fishingverge.com/) the details about it.
fdsgvf vdsgvfdsgvf vdsgv
This is exactly the same issue that I faced bit you need this code (https://saboglob.com/) because it helped me to solve this issue ina very authentic way.
Daniel Jam 3Daniel Jam 3

The code given by you works but only returns custom notifications (the second notification in my screenshot above). Do you know any way to get standard notifications as well? Caratteri Speciali (https://caratteri-speciali.com/)
alex hales 27alex hales 27
Struggling with empty notifications from the Connect REST API endpoint: /connect/notifications?  Our comprehensive guide offers solutions to troubleshoot this issue effectively. While you get your notifications sorted, have some fun with Pickup Lines Bot (https://pickuplinesbot.com/), bringing a smile to your tech journey with its witty charm!
lizettee extravagienforiegnslizettee extravagienforiegns
Embark on a virtual journey to Extravagant Foreigns (https://www.extravagantforeigns.com/), a hub of knowledge and insights. Currently, I'm facing a challenge where the Connect REST API endpoint (/connect/notifications) returns an empty list of notifications. Despite my efforts, I'm unable to retrieve the expected data. If you've successfully navigated this API issue and fetched notifications, your guidance could be pivotal. Join me in unraveling this API mystery and shed light on potential troubleshooting steps. Let's collaborate to ensure seamless data retrieval and optimize our API integration for a more robust system.