# Pins

## Overview

Sometimes you'll want to pin your favorite activity to a feed. You can pin an activity like this:

<codetabs>

<codetabs-item value="swift" label="Swift">

```swift
let activity = client.activity(
    for: "activity_123",
    in: FeedId(group: "user", id: "john")
)
// Pin an activity
try await activity.pin()

// Unpin an activity
try await activity.unpin()
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
// Pin an activity
client.pinActivity({
  feed_group_id: feed.group,
  feed_id: feed.id,
  activity_id: "activity_123",
});

// Unpin an activity
client.unpinActivity({
  feed_group_id: feed.group,
  feed_id: feed.id,
  activity_id: "activity_123",
});
```

</codetabs-item>

<codetabs-item value="nodejs" label="Node">

```js
// Pin an activity
client.feeds.pinActivity({
  feed_group_id: feed.group,
  feed_id: feed.id,
  activity_id: "activity_123",
  user_id: "<user id>",
});

// Unpin an activity
client.feeds.unpinActivity({
  feed_group_id: feed.group,
  feed_id: feed.id,
  activity_id: "activity_123",
  user_id: "<user id>",
});
```

</codetabs-item>

<codetabs-item value="go-golang" label="Go">

```go
package main

import (
    "context"
    "log"

    "github.com/GetStream/getstream-go/v3"
)

func main() {
    client, err := getstream.NewClient("<your_api_key>", "<your_api_secret>")
    if err != nil {
        log.Fatal(err)
    }

    ctx := context.Background()

    feedsClient := client.Feeds()

    // Get the feed
    feed := feedsClient.Feed("user", "john")

    // Pin an activity
    pinResponse, err := feed.PinActivity(ctx, "activity_123", &getstream.PinActivityRequest{})
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("Activity pinned: %+v", pinResponse.Data)

    // Unpin an activity
    unpinResponse, err := feed.UnpinActivity(ctx, "activity_123", &getstream.UnpinActivityRequest{})
    if err != nil {
        log.Fatal(err)
    }
    log.Printf("Activity unpinned: %+v", unpinResponse.Data)
}
```

</codetabs-item>

</codetabs>

When you read a feed pinned activities are automatically returned:

<codetabs>

<codetabs-item value="swift" label="Swift">

```swift
try await feed.getOrCreate()
print(feed.state.pinnedActivities)
```

</codetabs-item>

<codetabs-item value="javascript" label="JavaScript">

```js
const response = await feed.getOrCreate();
console.log(response.pinned_activities);
```

</codetabs-item>

<codetabs-item value="nodejs" label="Node">

```js
const response = await feed.getOrCreate({ user_id: "sara" });
console.log(response.pinned_activities);
```

</codetabs-item>

</codetabs>

---

This page was last updated at 2025-08-15T14:14:10.579Z.

For the most recent version of this documentation, visit [https://getstream.io/activity-feeds/docs/react-native/pins/](https://getstream.io/activity-feeds/docs/react-native/pins/).