How we can implement hashtag like feature using getstream
Asked Answered
D

1

6

I want to create functionality similar to hashtags on Twitter with the Getstream.io API. Users will post messages to their own flat feeds with certain hashtags. Then I want to be able to filter all activities based on a certain hashtag.

Decker answered 18/3, 2016 at 6:48 Comment(1)
I did not find anything in getstream documention.Decker
V
9

You have to think of a hashtag as a separate feed. Every hashtag is a topic feed with all activities posted with that specific identifier in their object. Thus to achieve this behavior with Getstream we need to create a feed group that can store feeds for all hashtags (or topics). Often such a feed group is called topic but you could also name it hashtag (create new feed groups on the getstream.io dashboard). Now we need to be able to send activities to their corresponding topic feeds when posted to a users' flat feed. For this we can use the to field of activities. When a user posts an activity with hashtag computers in the message we will create the following activity on the users flat feed:

{
    "actor": "user:1",
    "object": "I love #computers ^^"
    "verb": "tweet",
    "to": ["topic:computers"]
}

The to field will make sure the activity is also added to the topic feed and distributed to all the followers of this topic feed.

Verbify answered 18/3, 2016 at 9:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.