How to Get Real-Time Trend Alerts in Slack
Step-by-step guide to real-time trend alerts in Slack using TrendsAGI velocity data, signed webhooks, Python SDK, and Slack Incoming Webhooks with rate-limit

Teams searching for real-time trend alerts Slack want velocity and growth signals delivered straight into the channels where work already happens. Instead of checking separate dashboards, marketers, newsrooms, and ops teams can route rising topics, crisis signals, and watchlist matches into Slack so action happens before a campaign window or news cycle closes.
TrendsAGI supplies the upstream trend intelligence—measured velocity from stored snapshots, growth, AI insights, recommendations, and crisis events—while Slack receives the alerts through its Incoming Webhooks or through TrendsAGI’s native Slack notifications. This guide walks through both paths using only supported endpoints, the Python SDK, and signed webhooks, with concrete setup steps, working code, rate-limit handling, and practical use cases.
What you need before starting
You need a TrendsAGI account with an API key created in the account profile, a Slack workspace where you can install apps, and basic familiarity with environment variables. Velocity in TrendsAGI is a measured snapshot rate (posts per hour), not a forecast or unique-user count. Recommendation confidence measures evidence completeness, not probability of success.
Slack is a workplace collaboration platform used for messaging, channels, and integrations. Its developer platform provides Incoming Webhooks for posting messages from external apps. Recent product updates include a rebuilt Activity tab for triage of notifications, DMs, mentions, and app alerts, plus AI-powered features such as Today daily briefing and real-time recaps.
Option 1: TrendsAGI native Slack notifications
TrendsAGI lists Slack notifications among its delivery methods alongside signed outbound webhooks, Google Sheets exports, and released ad-platform connectors. Once configured in the platform, trend velocity, category matches, crisis events, and watchlist alerts can be routed directly to Slack channels without writing intermediate code.
Exact setup steps, plan availability, and payload shape for the native Slack path are not detailed in the public API reference. Check the account delivery settings and the subscription page for current options. For teams that need full control over formatting or multi-channel routing, the custom path below is fully documented.
Option 2: Custom path with Slack Incoming Webhooks and TrendsAGI data
This path combines TrendsAGI’s REST API or Python SDK with Slack’s Incoming Webhooks. You create a unique webhook URL that posts into one chosen channel, then either poll TrendsAGI on a schedule or receive signed push events and forward them.
Step 1: Create a Slack Incoming Webhook
According to Slack Developer Docs (docs.slack.dev), Incoming Webhooks let an app post messages into Slack by sending a JSON payload to a unique URL that is specific to one user and one channel. To create one:
- Create or open a Slack app in your workspace.
- Activate Incoming Webhooks.
- Use Add New Webhook to Workspace and select the target channel.
A basic post is an HTTP POST with Content-type application/json and a body containing at least a text field. Incoming Webhooks support Block Kit layout blocks for richer messages but cannot override the channel, username, or icon chosen at install time. They are rate-limited to 1 request per second, with short bursts allowed; exceeding limits returns HTTP 429 with a Retry-After header.
Step 2: Install the TrendsAGI Python SDK
pip install trendsagi
export TRENDSAGI_API_KEY="your-key-here"
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
Step 3: Poll live trends and post a structured alert
The following script fetches the highest-velocity trends in a category, builds a concise Block Kit-style payload, and posts it to the Slack Incoming Webhook. It respects the 1-request-per-second guideline by adding a short sleep between posts.
import os
import time
import requests
from trendsagi import TrendsAGIClient
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
slack_url = os.environ["SLACK_WEBHOOK_URL"]
trends = client.get_trends(
category="Technology",
sort_by="velocity",
limit=5
)
for trend in trends.get("trends", []):
name = trend.get("name", "Unknown")
volume = trend.get("volume", 0)
trend_id = trend.get("id")
# Optional: enrich with AI insights
insights = {}
if trend_id:
try:
insights = client.get_ai_insights(trend_id)
except Exception:
pass
summary = insights.get("summary", "No summary available")
text = f"*Rising trend:* {name}\nVolume: {volume}\n{summary}"
payload = {
"text": text,
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": text
}
}
]
}
resp = requests.post(
slack_url,
json=payload,
headers={"Content-Type": "application/json"},
timeout=10
)
if resp.status_code == 429:
retry_after = int(resp.headers.get("Retry-After", 1))
time.sleep(retry_after)
requests.post(slack_url, json=payload, headers={"Content-Type": "application/json"}, timeout=10)
elif resp.status_code != 200:
print(f"Slack post failed: {resp.status_code} {resp.text}")
time.sleep(1.1) # stay under 1 req/s
The same pattern works with the lower-level REST endpoints. Authenticate with the header X-API-Key: <key> or Authorization: Bearer <key>. Useful calls include:
GET /api/trends?category=Technology&sort_by=velocity&limit=5GET /api/trends/{id}/ai-insightsGET /api/trends/{id}/analytics?period=24hGET /api/intelligence/crisis-eventsGET /api/intelligence/recommendations
Step 4: Push-based alerts with TrendsAGI signed webhooks
For near-real-time delivery without polling, create a TrendsAGI webhook that fires on velocity or category conditions, then have your receiver forward the event to Slack.
import os
import hmac
import hashlib
import requests
from flask import Flask, request # or any HTTP framework
app = Flask(__name__)
SIGNING_SECRET = os.environ["TRENDSAGI_WEBHOOK_SECRET"] # one-time secret from creation
SLACK_WEBHOOK_URL = os.environ["SLACK_WEBHOOK_URL"]
@app.route("/trendsagi-webhook", methods=["POST"])
def handle():
raw = request.get_data()
signature = request.headers.get("X-Webhook-Signature", "")
expected = hmac.new(
SIGNING_SECRET.encode(),
raw,
hashlib.sha256
).hexdigest()
if not hmac.compare_digest(expected, signature):
return "invalid signature", 401
# Do not assume field names. Send a test delivery from TrendsAGI
# and map the fields that actually arrive.
data = request.get_json(silent=True) or {}
# Example mapping after inspection:
# name = data.get("...")
# velocity = data.get("...")
text = f"Trend alert received. Inspect payload and map fields."
requests.post(
SLACK_WEBHOOK_URL,
json={"text": text},
headers={"Content-Type": "application/json"},
timeout=10
)
return "ok", 200
Create the subscription with:
POST /api/integrations/webhooks
{
"url": "https://your-server.example/trendsagi-webhook",
"trigger_type": "trend_velocity",
"delivery_mode": "threshold",
"threshold_value": 100,
"cooldown_seconds": 300
}
New subscriptions start paused. Send a test delivery with POST /api/integrations/webhooks/{id}/test, verify the signature and map the real fields, then activate with PATCH /api/integrations/webhooks/{id} and body {"is_active": true}. Rotate the signing secret with POST /api/integrations/webhooks/{id}/rotate-secret when needed. Delivery attempts are listed at GET /api/integrations/webhooks/{id}/executions.
Verify every delivery by computing the lowercase hex HMAC-SHA256 of the exact raw request body using the signing secret and comparing it with constant-time equality to the X-Webhook-Signature header.
Watchlist and crisis routing
For ongoing monitoring, create topic interests that fire on volume or percentage growth:
client.create_topic_interest(
keyword="AI chips",
alert_condition_type="volume_threshold",
volume_threshold_value=500
)
List crisis events with client methods or GET /api/intelligence/crisis-events and post the same structured message pattern into a dedicated triage channel. Ops teams that already use Slack for incident triage can keep external disruption signals in the same place as internal alerts.
Agent and MCP options
Teams building AI agents can expose TrendsAGI tools directly. After pip install trendsagi:
from trendsagi import TrendsAGIClient, TrendsAGITools
client = TrendsAGIClient(api_key=os.environ["TRENDSAGI_API_KEY"])
tools = TrendsAGITools(client) # read-only by default
# tools = TrendsAGITools(client, allow_writes=True) # adds write tools
openai_tools = tools.openai()
# or tools.openai_responses(), tools.anthropic(), tools.langchain()
result = tools.call("list_trends", {"category": "Technology", "sort_by": "velocity", "limit": 3})
trends = result["result"]["trends"]
An MCP server is also available: pip install "trendsagi[mcp]" then run trendsagi mcp (or trendsagi-mcp) with TRENDSAGI_API_KEY set. Add --allow-writes for write tools. Agents can then call list_trends, get_trend_ai_insights, list_crisis_events, or list_recommendations and decide when to post into Slack.
Troubleshooting
- HTTP 429 from Slack: Respect the 1 request per second limit. Read the Retry-After header and back off. Short bursts are allowed but sustained traffic above the limit will be rejected.
- Signature verification fails: Always hash the unmodified raw request body. Do not re-serialize JSON before verification. Use constant-time comparison.
- Empty or unexpected payload: TrendsAGI does not publish a fixed field list for webhook bodies in the reference used here. Send a test delivery and map the fields that arrive.
- Webhook stays paused: New subscriptions require an explicit test followed by a PATCH to set
is_active: true. - SDK authentication errors: Confirm the key is set in the environment and that the header form matches either X-API-Key or Authorization Bearer.
- Rate or usage limits on TrendsAGI: Check current consumption with
GET /api/user/api-usageor the corresponding SDK method.
Practical use cases
- Paid-media or growth team: Velocity alerts for a target category land in a campaign channel before a flight ends, letting the team reallocate budget or creative while the topic is still accelerating.
- Creator or newsroom: Structured spikes (name, volume, short AI summary, key themes) are routed to a production channel so editors can decide coverage without leaving Slack.
- Ops or support team: Crisis events and watchlist matches appear alongside internal triage messages, reducing context switching.
- Technical evaluation: Compare a custom detector plus Events API against a managed platform that already measures velocity and ships signed webhooks and Slack notifications. The managed path removes the need to maintain your own social scrapers and snapshot storage.
Trade-offs: custom pipeline versus managed platform
A fully custom pipeline (own detectors + Slack Events API or webhooks) gives maximum control over sources and latency but requires ongoing maintenance of data collection, storage, scoring, and delivery reliability. A managed trend platform supplies measured velocity, growth, AI insights, recommendations, and crisis detection out of the box, then hands the result to Slack via native notifications or signed webhooks. The choice depends on whether the team prefers to own the detection layer or focus engineering effort on downstream actions and channel routing.
Frequently asked questions
How do I create a Slack Incoming Webhook and post structured trend alerts to a channel?
Create or open a Slack app, activate Incoming Webhooks, then use Add New Webhook to Workspace and select a channel. Post a JSON body with at least a text field (and optional Block Kit blocks) to the unique URL. The webhook is bound to that channel and cannot override username or icon at send time.
What rate limits apply when posting alerts via Incoming Webhooks or chat.postMessage?
Incoming Webhooks are limited to 1 request per second per webhook, with short bursts allowed. Exceeding the limit returns HTTP 429 with a Retry-After header. Handle the status code and wait the indicated seconds before retrying.
Which tools already offer one-click or OAuth Slack delivery for real-time trend or signal alerts?
TrendsAGI lists Slack notifications as a supported delivery method alongside signed webhooks and Google Sheets exports. Exact one-click or OAuth steps and plan availability are not enumerated in the reference material used here; check the product delivery settings and subscription page.
How does TrendsAGI connect to Slack and what plan includes real-time Slack notifications?
TrendsAGI supports Slack notifications as a native delivery option and also provides signed outbound webhooks that any receiver can forward into Slack. Plan-level inclusion of real-time Slack notifications is not specified in the available fact sheet; refer to the current subscription page.
What should a useful trend alert payload contain so the team can act immediately?
At minimum: trend name, current volume or velocity indicator, a short AI-generated summary or key themes, category, and a link or ID for deeper inspection. Severity or priority flags help triage. Avoid dumping raw JSON; surface the fields the team will act on first.
What are the trade-offs of building a custom webhook pipeline versus using a managed trend platform?
Custom pipelines offer full control over data sources and scoring logic but require continuous maintenance of collectors, storage, and delivery. A managed platform supplies measured velocity, growth, insights, and crisis detection, then delivers via webhooks or native Slack notifications, shifting effort from detection to action.
How we researched this
Prepared by TrendsAGI Research. Facts checked on 16 October 2026 against the sources listed below.
We read the official Slack documentation listed below. The TrendsAGI steps and code use its documented REST API and Python SDK; confirm the Slack side against its current documentation, since third-party products change.
| Claim | Applies to | Source |
|---|---|---|
| Incoming webhooks let an app post messages into Slack by sending a JSON payload to a unique URL that is specific to one user and one channel. | All plans | docs.slack.dev |
| To create an incoming webhook you create or open a Slack app, activate Incoming Webhooks, then use Add New Webhook to Workspace and select a channel. | All plans | docs.slack.dev |
| A basic post to an incoming webhook is an HTTP POST with Content-type application/json and a body containing at least a text field. | All plans | docs.slack.dev |
| Incoming webhooks support Block Kit layout blocks for richer messages but cannot override the channel, username or icon chosen at install time. | All plans | docs.slack.dev |
| Incoming webhooks are rate-limited to 1 request per second, with short bursts allowed; exceeding limits returns HTTP 429 with a Retry-After header. | All plans | docs.slack.dev |
| The Events API lets Slack push event payloads to your app over HTTP or Socket Mode so the app can react to activity rather than polling. | All plans | docs.slack.dev |
We re-research and rewrite this page at least every four months; the updated date only changes when the facts are re-checked.