+ Start a Discussion
pkolyvanispkolyvanis 

Get all chatter posts that contain a specific hashtag

Hi,

 

I would like to implement a "search by hashtag" type of feature, and retrieve all the text posts that contain a specific hashtag (e.g. #tag).

 

Can you please let me know if that's currently possible using the Chatter REST API?

 

A quick test shows that my json response does contain a search link for a specific hashtag (as seen below) but this link does not seem to be usable with OAuth.

 

...

"body":{"text":"this is a #tag","messageSegments":[{"type":"Text","text":"this is a "},{"type":"Hashtag","text":"#tag","tag":"tag","url":"/_ui/common/search/client/ui/ChatterSearchResultsPage?str=%23tag&sen=a0f&sen=a0e&sen=a0d&sen=068&sen=a0D&sen=005&sen=a0G&sen=a0J&sen=a0i&sen=015&sen=a0g&sen=a0V&sen=a01&sen=a02&sen=a0P&sen=a08&sen=a0Y&sen=a0Z&sen=0F9&cache=grdlvher&chatterSearchArea=FEED_TOPIC_FEED_LINK_CLICK"}]}

...

 

If this is not currently possible using the Chatter REST API, can you please let me know how to access the messageSegments using the Salesforce REST API?

 

Thanks in advance,

Panos.

LoganLogan

In the current Chatter API developer preview you have to read in the entire feed and then filter out the feed items that don't contain the hashtag.  Obviously this isn't practical in most situations, which is why we're implementing native search in the GA release of the Chatter API.

 

AFAIK in the sobject REST API you could put together a SOQL query that scanned for the hashtag in the feed item body - you don't need message segments.