# Implementing Hashtags in Stream Activity Feeds
## Overview
Stream's Activity Feeds support hashtag functionality through a combination of feed groups and TO field targeting. This guide explains how to set up and implement hashtags in your application.
## Setting Up Hashtag Feeds
### 1. Create a Feed Group
- Log into the Stream Dashboard
- Create a new feed group (e.g., 'hashtag' or 'tag')
- Set appropriate permissions (typically global read/write for hashtag functionality)
### 2. Implementing Hashtag Targeting
When creating activities that contain hashtags, use the TO field to target the hashtag feed:
```javascript
// Example: Targeting a post with #sydney hashtag
activity = {
actor: 'user:123',
verb: 'post',
object: 'post:456',
to: ['hashtag:sydney']
}
```
### Key Points
- Feed groups must be created via the Dashboard - they cannot be created programmatically
- Individual hashtag feeds (e.g., 'sydney' in 'hashtag:sydney') are created automatically when first targeted
- The targeting syntax must match your feed group name (e.g., 'hashtag:term' if your feed group is named 'hashtag')
## Best Practices
- Choose a consistent feed group name for hashtags
- Consider using global permissions for hashtag feed groups to allow all users to interact
- Remember that hashtag feeds are created dynamically when first targeted
## Common Issues
- Ensure the feed group exists before targeting
- Verify the TO field syntax matches your feed group name
- Check feed group permissions if experiencing access issues
Comments
0 comments
Please sign in to leave a comment.