> ## Documentation Index
> Fetch the complete documentation index at: https://docs.snagsolutions.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quality Social Farming

> Spotlight and reward meaningful user-generated content by displaying posts from users who have completed relevant social quests.

<head>
  <script type="application/ld+json">
    {JSON.stringify({
            "@context": "https://schema.org",
            "@graph": [
              {
                "@type": "TechArticle",
                "headline": "Quality Social Farming",
                "description": "Spotlight and reward meaningful user-generated content by displaying posts from users who have completed relevant social quests.",
                "author": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/"},
                "publisher": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/", "logo": {"@type": "ImageObject", "url": "https://assets.snagsolutions.io/public/docs/snag-logo-dark-no-bg.svg"}},
                "mainEntityOfPage": "https://docs.snagsolutions.io/loyalty/quality-social-farming"
              },
              {
                "@type": "BreadcrumbList",
                "itemListElement": [
                  {"@type": "ListItem", "position": 1, "name": "Home", "item": "https://docs.snagsolutions.io/welcome"},
                  {"@type": "ListItem", "position": 2, "name": "Loyalty", "item": "https://docs.snagsolutions.io/loyalty/loyalty-overview"},
                  {"@type": "ListItem", "position": 3, "name": "Features", "item": "https://docs.snagsolutions.io/loyalty/updating-balances"},
                  {"@type": "ListItem", "position": 4, "name": "Quality Social Farming"}
                ]
              }
            ]
          })}
  </script>
</head>

Quality Social Farming allows you to showcase and reward user-generated social content. The feed displays posts from users who have completed specific social quests, helping you highlight quality content and engage your community.

<Note>
  Quality Social Farming is a Pro plan feature. Ensure your plan has' ' <strong>Quality Social Farming</strong>
  enabled.
</Note>

## How Quality Social Farming works

* **Social Feed**: A curated feed of up to 1,000 top posts from users who completed relevant social quests
* **Automatic Ranking**: Posts are automatically ranked using AI based on engagement, quality, and relevance
* **Manual Ranking**: Admins can manually reorder posts by dragging and dropping, which locks them from automatic AI reordering
* **Filtering**: Filter posts by time period, rule type, X verified status, media content, and search terms
* **Individual Rewards**: Reward specific posts with loyalty points to incentivize quality content
* **Public Display**: Toggle to show the feed in the right column of your loyalty page

## How post quality is calculated

Posts are automatically analyzed using AI to determine their quality and sentiment. The quality calculation consists of two main components:

### Sentiment Score (1-100)

Each post receives a sentiment score from 1-100 that evaluates both positivity and content quality:

* **1-40**: Low-quality content including AI-generated spam, incentive farming, generic spam (vague praise, copy-paste content, irrelevant hashtags, engagement bait)
* **40-60**: Positive sentiment but low-effort content
* **75-100**: Positive sentiment with substantive, high-quality content

<Note>
  Posts must have a sentiment score of 75 or higher to be considered "quality posts" when the "Only reward quality posts" option is enabled on social quest rules.
</Note>

### Content Quality Score (0-10)

The AI also calculates a content quality score (0-10) based on:

* Quality and depth of content
* Clarity and coherence
* Engagement potential
* Uniqueness and creativity
* Relevance to the quest topic

### Final Ranking Score

The final ranking score combines multiple factors with weighted importance:

* **Content Quality** (40%): Based on AI analysis of the post content
* **Likes** (15%): Number of likes received
* **Views** (15%): Number of views/impressions
* **Comments** (10%): Number of comments
* **Reposts** (10%): Number of reposts/shares
* **Followers** (10%): Author's follower count
* **Media** (0%): Currently not weighted in the calculation

This weighted scoring ensures that high-quality, engaging content ranks higher in the social feed, while still considering engagement metrics and author influence.

## Supported rule types

The social feed only displays posts from users who have completed these specific social quest rule types:

* [**Post on X**](/loyalty/rules/x-new-tweet) (`drip_x_new_tweet`) - Users create a new post on X, optionally with specific text
* [**Comment on an X Post with Text**](/loyalty/rules/x-text-in-comment) (`drip_x_text_in_comment`) - Users comment on any X post with specific text
* [**React to an X Post**](/loyalty/rules/x-post-reaction) (`drip_x_tweet`) - Users like, comment, or repost a specific X post
* **Post with Hashtag** (`twitter_post_hashtag`) - Users post on X containing a specific hashtag or mention
* **Comment on X Post** (`twitter_comment`) - Users comment on a specific X post

<Note>
  To populate your social feed, you need to create at least one of these rule types. Posts will only appear in the feed after users complete the corresponding quests.
</Note>

## Configure the social feed

### Enable public feed display

To show the social feed on your loyalty page:

<Steps>
  <Step title="Navigate to Quality Social Farming">
    From the admin app, go to Loyalty → Quality Social Farming.
  </Step>

  <Step title="Toggle Show Social Feed">
    Enable the "Show social feed" toggle at the top of the page. This displays the top 1,000 posts in the right column of your loyalty page.
  </Step>
</Steps>

### Filter and search posts

The admin interface provides several filtering options:

* **Social Content Rules**: Filter by specific rule type or view all rules
* **Duration**: Filter by time period (Last 24 hours, 3 days, 7 days, 30 days, or All time)
* **More Filters**:
  * **Contains media**: Show only posts with images or videos
  * **X verified**: Show only posts from verified X accounts
* **Search**: Search posts by content, username, or other metadata

### Manual ranking

You can manually reorder posts to highlight specific content:

<Steps>
  <Step title="Disable filters">
    Clear any active filters (duration, rule type, search, etc.) to enable drag-and-drop ranking.
  </Step>

  <Step title="Drag and drop">
    Click and hold the grip icon (⋮⋮) next to a post and drag it to your desired position.
  </Step>

  <Step title="Save">
    The new rank is saved automatically. Note that manual ranking can take up to an hour to update on the public feed.
  </Step>
</Steps>

<Warning>
  When you manually rank a post, it becomes locked and will not be automatically reordered by AI. Use "Unlock All" to clear all manual ranks and allow automatic AI reordering.
</Warning>

### Reward individual posts

You can reward specific posts to incentivize quality content:

<Steps>
  <Step title="Select a post">
    Click on a post in the feed to view its details.
  </Step>

  <Step title="Set reward amount">
    Enter the reward amount and select the loyalty currency.
  </Step>

  <Step title="Submit">
    The reward is processed immediately and credited to the user's account.
  </Step>
</Steps>

### Sort options

Posts can be sorted by:

* **Rank**: Default sorting by AI-calculated rank (shows top 10,000 posts with exact ranks)
* **Created at**: Sort by post creation date (newest or oldest first)

## API reference

### Get social posts

Fetch social posts with filtering and pagination options.

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET 'https://admin.snagsolutions.io/api/loyalty/posts?websiteId=WEB_ID&organizationId=ORG_ID&limit=20&page=1&duration=all&sortBy=rank' \
    -H 'X-API-KEY: YOUR_API_KEY'
  ```
</RequestExample>

**Query Parameters:**

* `websiteId` (required): Your website ID
* `organizationId` (required): Your organization ID
* `loyaltyRuleId` (optional): Filter by specific rule ID or omit to show all rules
* `duration` (optional): Time filter - `24h`, `3d`, `7d`, `30d`, or `all` (default)
* `xVerified` (optional): Filter for verified X accounts - `true` or `false`
* `containsMedia` (optional): Filter for posts with media - `true` or `false`
* `search` (optional): Search term to filter posts
* `sortBy` (optional): Sort order - `rank` (default) or `createdAt`
* `page` (optional): Page number for pagination (default: 1)
* `limit` (optional): Number of posts per page (default: 10, max: 1000)
* `isAdmin` (optional): Include admin-only fields - `true` or `false`

**Response:**

```json theme={null}
{
  "data": [
    {
      "id": "post-id",
      "loyaltyRuleId": "rule-id",
      "userId": "user-id",
      "rank": 1,
      "manualRank": null,
      "createdAt": "2024-01-15T10:30:00Z",
      "postContent": "User's post content...",
      "postUrl": "https://x.com/user/status/123",
      "xVerified": true,
      "containsMedia": true,
      "user": {
        "walletAddress": "0x...",
        "twitterUser": "username"
      }
    }
  ],
  "hasNextPage": false,
  "cursor": "next-page-cursor",
  "stats": {
    "hasManualRankedPosts": false
  }
}
```

### Update post sort order

Manually set the rank of a post (locks it from AI reordering).

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://admin.snagsolutions.io/api/loyalty/posts/POST_ID' \
    -H 'X-API-KEY: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "manualRank": 5,
      "previousRank": 10
    }'
  ```
</RequestExample>

**Body Parameters:**

* `manualRank` (required): The new manual rank position
* `previousRank` (optional): The previous rank if moving down in the list

### Reward a post

Reward a user for their social post.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://admin.snagsolutions.io/api/loyalty/posts/POST_ID/reward' \
    -H 'X-API-KEY: YOUR_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
      "amount": "100",
      "loyaltyCurrencyId": "currency-id"
    }'
  ```
</RequestExample>

**Body Parameters:**

* `amount` (required): The reward amount as a string
* `loyaltyCurrencyId` (required): The ID of the loyalty currency to reward

### Unlock all posts

Clear all manual ranks to allow automatic AI reordering.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://admin.snagsolutions.io/api/loyalty/posts?websiteId=WEB_ID&organizationId=ORG_ID&clearManualRanks=true' \
    -H 'X-API-KEY: YOUR_API_KEY'
  ```
</RequestExample>

## Best practices

* **Create relevant quests**: Set up social quests that encourage meaningful content creation aligned with your community goals
* **Regular moderation**: Review and manually rank high-quality posts to highlight them in the feed
* **Reward quality**: Use individual post rewards to incentivize exceptional content
* **Monitor engagement**: Use filters to identify trending content and verified accounts
* **Balance automation**: Use manual ranking sparingly for truly exceptional content; let AI handle the majority of ranking
* **Clear communication**: Inform users about the social feed and how posts are selected

## Troubleshooting

* **No posts appearing**: Ensure you have created at least one supported social quest rule type and that users have completed those quests
* **Manual rank not updating**: Manual ranking changes can take up to an hour to reflect on the public feed
* **Posts not ranking correctly**: Check if posts have manual ranks set; use "Unlock All" to clear manual ranks and allow AI reordering
* **API errors**: Ensure your API key has the necessary permissions for `loyaltyPost` resources
