Skip to content

[Recording Oracle] Marketing jobs - social media posts #3858

@portuu3

Description

@portuu3

Description
Use the Fortune Recording Oracle as the base and extend it to support social media promotion validation.

Implementation details

  • Load manifest requirements
  • Send a request to grok AI to validate the post
  • Check first how long the post has been active, if minimum required is not met wait until it is if the post still exists, if it doesn't exist consider it a bad submission

Prompt example:

Analyze this X/Twitter post URL for potential bot activity among its reposts: ${postUrl}

Please analyze the following indicators that might suggest bot-driven repost activity:

1. **Timing patterns**: Are reposts clustered in suspiciously short time windows?
2. **Account characteristics**: Do reposting accounts show signs of being bots (default avatars, random usernames, low follower counts, high following counts, recent creation dates)?
3. **Engagement ratios**: Is the repost count disproportionate to likes/replies?
4. **Content patterns**: Are there coordinated amplification signals?
5. **Network analysis**: Do reposting accounts have suspiciously high overlap in their followers/following?

During your analysis, have in mind the following:
- Do not consider crypto related activity as risky.
- Include any relevant numbers or examples you can infer.

Respond with a JSON object in this exact format:
{
  "overallBotProbability": "low" | "medium" | "high",
  "suspiciousPatterns": ["list of specific patterns detected"],
  "summary": "Brief explanation of your analysis and recommendations"
}

Return ONLY the JSON object, no additional text.

Script used for testing:

import 'dotenv/config';

interface RepostAnalysis {
  overallBotProbability: 'low' | 'medium' | 'high';
  suspiciousPatterns: string[];
  summary: string;
}

interface GrokChatCompletionResponse {
  choices?: Array<{
    message?: {
      content?: string | null;
    };
  }>;
  error?: {
    message?: string;
  };
}

function getGrokConfig(): { apiKey: string; baseUrl: string; model: string } {
  const apiKey = process.env.XAI_API_KEY ?? process.env.GROK_API_KEY;

  if (!apiKey) {
    throw new Error(
      'Missing Grok credentials. Set XAI_API_KEY or GROK_API_KEY in .env.',
    );
  }

  return {
    apiKey,
    baseUrl: process.env.XAI_BASE_URL ?? 'https://api.x.ai/v1',
    model: process.env.GROK_MODEL ?? 'grok-4-1-fast-reasoning',
  };
}

async function analyzeRepostsForBots(postUrl: string): Promise<RepostAnalysis> {
  const { apiKey, baseUrl, model } = getGrokConfig();

  const response = await fetch(`${baseUrl}/chat/completions`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      Authorization: `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
      model,
      stream: false,
      messages: [
        {
          role: 'system',
          content: 'You analyze X repost activity and return only valid JSON.',
        },
        {
          role: 'user',
          content: `Analyze this X/Twitter post URL for potential bot activity among its reposts: ${postUrl}

Please analyze the following indicators that might suggest bot-driven repost activity:

1. **Timing patterns**: Are reposts clustered in suspiciously short time windows?
2. **Account characteristics**: Do reposting accounts show signs of being bots (default avatars, random usernames, low follower counts, high following counts, recent creation dates)?
3. **Engagement ratios**: Is the repost count disproportionate to likes/replies?
4. **Content patterns**: Are there coordinated amplification signals?
5. **Network analysis**: Do reposting accounts have suspiciously high overlap in their followers/following?

During your analysis, have in mind the following:
- Do not consider crypto related activity as risky.
- Include any relevant numbers or examples you can infer.

Respond with a JSON object in this exact format:
{
  "overallBotProbability": "low" | "medium" | "high",
  "suspiciousPatterns": ["list of specific patterns detected"],
  "summary": "Brief explanation of your analysis and recommendations"
}

Return ONLY the JSON object, no additional text.`,
        },
      ],
    }),
  });

  const payload = (await response.json()) as GrokChatCompletionResponse;

  if (!response.ok) {
    throw new Error(
      payload.error?.message ?? `Grok API request failed with HTTP ${response.status}`,
    );
  }

  const responseText = payload.choices?.[0]?.message?.content ?? '';

  try {
    return JSON.parse(responseText) as RepostAnalysis;
  } catch {
    return {
      overallBotProbability: 'medium',
      suspiciousPatterns: ['Unable to parse structured response'],
      summary: responseText,
    };
  }
}

async function main() {
  const testUrl =
    process.argv[2];

  console.log('\nAnalyzing reposts for potential bot activity with Grok...');
  console.log(`Post URL: ${testUrl}\n`);

  const analysis = await analyzeRepostsForBots(testUrl);

  console.log('=== Bot Activity Analysis ===\n');
  console.log(`Overall Bot Probability: ${analysis.overallBotProbability.toUpperCase()}`);
  console.log('\nSuspicious Patterns Detected:');
  analysis.suspiciousPatterns.forEach((pattern, i) => {
    console.log(`  ${i + 1}. ${pattern}`);
  });
  console.log(`\nSummary: ${analysis.summary}`);
}

main().catch(console.error);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions