Unfortunately, no. The endpoint you're using seems exactly what you want/need - but, as you noted, will only give you custom notifications.
You can see this older question that mentions the lack of ability to get Chatter notifications in API/Apex. You can also see the following idea that was created and archived for low activity.
A workaround would involve a heavy lift (in addition to using the endpoint you mentioned) as it wouldn't really retrieve "notifications", but the underlying feed items. Below I'll detail some methods and possibilities - but, it's likely not a good enough solution to use depending on what you're replicating/doing with notifications.
With the ConnectApi Namespace, you do have several options for pulling the feed for a context user with various parameters. You can specify a ConnectApi.FeedType and the good news is that ConnectApi.FeedType.News
should contain what you're interested in
Contains all updates for people the context user follows, groups the
user is a member of, and files and records the user is following.
Contains all updates for records whose parent is the context user.
The issue will be limiting the data returned to what you're interested in. You'd need one or both of the following:
- Ability to see what feed elements are unread
- Ability to only return elements from a certain time period (to limit processing)
There is a isReadByMe
property within the model of information returned. The ability to filter at the request level and only return elements that are "unread" is done through ConnectApi.FeedFilter and that type of filter is limited in its application.
Unread
— Feed elements that are created in the past 30 days and aren’t
marked as read for the context user. This value is valid only for the
Record feed of a group.
There does seem to be an updatedSince
parameter that is returned in certain calls (or you can build) that can be passed to other methods to retrieve only items since a date.
updatedSince
shows the following for right now:
4:1641914920468
- To the right of the colon is the date in milliseconds
- The left of the colon, I believe, corresponds to the FeedSortOrder enum - 4, this case, refers to
LastModifiedDateDesc
You could do an initial query/retrieval with getFeedElementsFromFeed. You'd have to utilize pageParam
and pageSize
as you might be querying a lot at this point. This would provide the following:
After having a updatesToken
, you could then pass that in subsequent calls/retrievals to ConnectApi.ChatterFeeds.getFeedElementsUpdatedSince that returns the same things as the above method, but limits based on updated time:
Get a page of feed elements from the Files, Groups, News, People, and
Record feeds. Include only feed elements that have been updated since
the time specified in the updatedSince parameter.
Of course, you could skip the first initial query and just rely on the updatedSince
parameter if you construct your own updatedSince
token using milliseconds.
DateTime prevDay = DateTime.now().addDays(-1);
String sinceYesterday = '4:' + String.valueOf(prevDay.millisecond());
ConnectApi.FeedElementPage myNews = ConnectApi.ChatterFeeds.getFeedElementsUpdatedSince(
null,
ConnectApi.FeedType.News,
'me',
3,
ConnectApi.FeedDensity.AllUpdates,
null,
25,
sinceYesterday
);
//see if item has not been read
for(ConnectApi.FeedElement feedElem : myNews){
if(!feedElem.capabilities.readBy.isReadByMe){
//...
}
}
Best Answer
I could see it working (outside of Communities, I have not tried that part yet) with the following scenarios:
standard__namedPage
): quite limited but useful.standard__navItemPage
): navigates to tabs.standard__recordPage
): navigates to a records, in modes such as view, edit (my example), and clone.Conclusion so far: it seems that the comment from Bartheleway,
setTargetPageRef
using JSON format syntax is correct, based on my tests, at least.Note: thanks for the references shared, that LWC PageReference Types & CustomNotification Class references served as the basis of the tests I made.
Code to send a notification to the current user: