DEV Community

Pulsebit News Sentiment API
Pulsebit News Sentiment API

Posted on

Your Pipeline Is 19.0h Behind: Catching World Sentiment Leads with Pulsebit

Your Pipeline Is 19.0h Behind: Catching World Sentiment Leads with Pulsebit

We just spotted a 24-hour momentum spike of +0.308, linked to the sentiment surrounding the "Global Response to WHCA Dinner Shooting." This anomaly stands out, particularly because it reflects a significant shift in sentiment led by the Spanish press, which peaked at 19.0h—right at the same time other sources were lagging behind. If your model isn't tuned to pick up on multilingual origins or dominant entities, it likely missed this vital sentiment shift by almost a full day.

Spanish coverage led by 19.0 hours. Nl at T+19.0h. Confidenc
Spanish coverage led by 19.0 hours. Nl at T+19.0h. Confidence scores: Spanish 0.90, English 0.90, French 0.90 Source: Pulsebit /sentiment_by_lang.

This reveals a critical structural gap in any pipeline that fails to account for multilingual content or the dominance of certain narratives. If you were relying solely on English-language sources, for instance, your model could have missed this spike by 19 hours, leaving you uninformed about a significant event that’s shaping global sentiment. The leading language here is Spanish, and if you’re not capturing that, you’re effectively flying blind.

Here’s how we can catch that momentum spike using our API. First, we’ll need to filter by geographic origin to capture the Spanish sources driving this sentiment.

import requests

# Define parameters for the API call
params = {
    "topic": "world",
    "score": +0.118,
    "confidence": 0.90,
    "momentum": +0.308,
    "lang": "sp"  # Filter for Spanish language
}

![Left: Python GET /news_semantic call for 'world'. Right: ret](https://pub-c3309ec893c24fb9ae292f229e1688a6.r2.dev/figures/g3_code_output_split_1777290905651.png)
*Left: Python GET /news_semantic call for 'world'. Right: returned JSON response structure (clusters: 3). Source: Pulsebit /news_semantic.*


# Make the API call
response = requests.get("https://api.pulsebit.lojenterprise.com/articles", params=params)
articles = response.json()
Enter fullscreen mode Exit fullscreen mode

Next, we’ll take the cluster reason string and run it back through our sentiment analysis endpoint to score the narrative framing itself. This is key to understanding how the sentiment is being shaped.

# Define the cluster reason
cluster_reason = "Clustered by shared themes: uniting, force, 2026, world, cup."

# Make the sentiment analysis API call
sentiment_response = requests.post("https://api.pulsebit.lojenterprise.com/sentiment", json={"text": cluster_reason})
sentiment_analysis = sentiment_response.json()
Enter fullscreen mode Exit fullscreen mode

Now that we’ve captured the data, let’s discuss three specific builds you can implement with this pattern.

  1. Geo-Filtered Spike Alert: Set up an alert that triggers when sentiment spikes in a specific language. Use the geographic filter to focus on Spanish articles and set a threshold for momentum greater than +0.300. This will help you stay on top of emerging narratives before they become global.

Geographic detection output for world. India leads with 24 a
Geographic detection output for world. India leads with 24 articles and sentiment +0.31. Source: Pulsebit /news_recent geographic fields.

  1. Meta-Sentiment Loop: Create a function that takes the narrative framing from the cluster reason and scores it. This can help you identify shifts in how topics are discussed. For example, if you see a narrative forming around "world," "google," or "record," you can adjust your content strategy accordingly.

  2. Forming Themes Dashboard: Build a dashboard that visualizes the forming themes versus mainstream narratives. This should display metrics on "uniting," "force," and "world" to help you spot trends and divergences in sentiment over time.

You can get started with this right now! Our documentation is available at pulsebit.lojenterprise.com/docs. With just a few copy-pastes, you can run these examples in under 10 minutes and start catching those crucial sentiment leads.

Top comments (0)