Back to Blog
Twitter/X

Crypto Sentiment Analysis: Build a Twitter Bot to Track Bullish Signals

December 7, 2025
3 min read
S
By SociaVault Team
CryptoTwitterSentiment AnalysisTrading Bot

The "Whale Watching" Strategy

In crypto, price follows narrative. And narrative is built on X (formerly Twitter). But you can't read every tweet.

Instead of trying to read everything, smart traders monitor Key Opinion Leaders (KOLs) and Specific Communities. If Vitalik Buterin and Michael Saylor both tweet about "scalability" on the same day, that's a signal.

In this guide, we'll build a Crypto Sentiment Bot that:

  1. Monitors a watchlist of top influencers.
  2. Scrapes active Crypto Communities.
  3. Scores the "Bullishness" of the last 24 hours.

The Tech Stack

We'll use the SociaVault API to fetch tweets without needing the expensive ($100/mo+) X API.

Prerequisites

  • Node.js installed
  • A SociaVault API Key
  • axios for API requests

Step 1: Monitoring the "Whales"

First, let's build a function to get the latest tweets from a list of influential handles.

const axios = require('axios');

const API_KEY = 'YOUR_SOCIAVAULT_API_KEY';
const BASE_URL = 'https://api.sociavault.com/v1/scrape/twitter';

const WHALE_WATCHLIST = ['VitalikButerin', 'saylor', 'cz_binance', 'SBF_FTX' /* just kidding */];

async function getWhaleTweets(handle) {
  try {
    const response = await axios.get(`${BASE_URL}/user-tweets`, {
      params: { handle },
      headers: { 'x-api-key': API_KEY }
    });

    return response.data.data.tweets || [];
  } catch (error) {
    console.error(`Error fetching ${handle}:`, error.message);
    return [];
  }
}

Step 2: Community Pulse

Twitter Communities are where the real alpha is often discussed before it hits the timeline. Let's scrape a community.

async function getCommunityPulse(communityUrl) {
  try {
    console.log(`\nπŸ” Scanning Community: ${communityUrl}`);
    const response = await axios.get(`${BASE_URL}/community/tweets`, {
      params: { url: communityUrl },
      headers: { 'x-api-key': API_KEY }
    });

    return response.data.data.tweets || [];
  } catch (error) {
    console.error('Error fetching community:', error.message);
    return [];
  }
}

Step 3: The Sentiment Scorer

Now, let's analyze the text. In a real production app, you'd use OpenAI or a sentiment library. For this script, we'll use a simple keyword scoring system.

function analyzeSentiment(tweets) {
  const bullishKeywords = ['buy', 'long', 'moon', 'bull', 'breakout', 'ath', 'accumulate', 'wagmi'];
  const bearishKeywords = ['sell', 'short', 'dump', 'bear', 'crash', 'correction', 'fud', 'ngmi'];

  let score = 0;
  let mentions = 0;

  tweets.forEach(tweet => {
    const text = tweet.text.toLowerCase();
    
    bullishKeywords.forEach(word => {
      if (text.includes(word)) score++;
    });

    bearishKeywords.forEach(word => {
      if (text.includes(word)) score--;
    });
    
    mentions++;
  });

  return { score, mentions };
}

Step 4: The Dashboard Script

Let's put it all together.

async function runCryptoBot() {
  console.log("πŸš€ Starting Crypto Sentiment Bot...");

  // 1. Analyze Whales
  console.log("\nπŸ‹ Whale Watch Analysis:");
  for (const handle of WHALE_WATCHLIST) {
    const tweets = await getWhaleTweets(handle);
    const { score } = analyzeSentiment(tweets);
    
    let sentiment = 'NEUTRAL';
    if (score > 0) sentiment = '🟒 BULLISH';
    if (score < 0) sentiment = 'πŸ”΄ BEARISH';

    console.log(`${handle}: ${sentiment} (Score: ${score})`);
  }

  // 2. Analyze a Community (e.g., a Bitcoin Community)
  // Replace with a real community URL you want to track
  const BITCOIN_COMMUNITY = 'https://x.com/i/communities/1509286168272580613'; 
  
  const communityTweets = await getCommunityPulse(BITCOIN_COMMUNITY);
  const communityStats = analyzeSentiment(communityTweets);

  console.log(`\n🌐 Community Sentiment:`);
  console.log(`Score: ${communityStats.score}`);
  console.log(`Volume: ${communityStats.mentions} tweets analyzed`);
}

runCryptoBot();

Why This Matters in 2025

In 2025, "Alpha" isn't about being the first to know newsβ€”it's about being the first to quantify reaction to news.

By automating this sentiment check, you can:

  1. Alert yourself when sentiment flips negative across all whales.
  2. Spot divergences (e.g., Price is down, but Whales are posting bullish keywords).
  3. Filter noise by ignoring low-quality accounts.

Next Steps

Build your own trading signal bot.

Get Your API Key β†’

Found this helpful?

Share it with others who might benefit

Ready to Try SociaVault?

Start extracting social media data with our powerful API. No credit card required.