Resumen
Este flujo de trabajo searches Reddit for menciones of your marca, producto, o chosen palabras clave at regular intervals. Cuando nuevo menciones son encontrado, it formats them en un Slack mensaje con el publicacion titulo, subreddit, puntuacion, y un direct enlace. Teams usar este to catch retroalimentacion del cliente, competidor menciones, y community discussions antes de they go viral.
Desencadenador
Cron programar (cada 4 horas)
Programación
Ejecuta cada 4 horas
Pasos del flujo de trabajo
Define marca palabras clave
Set el lista of marca names, producto names, y competidor names to monitorear on Reddit.
Search Reddit via Scavio
Call el Scavio API con plataforma reddit for cada palabra clave, ordenamiento by recency.
Filtrar nuevo menciones
Comparar resultados contra el lista of already-seen publicacion IDs almacenado de anterior ejecuta.
Format Slack mensaje
Construir un Slack Block Kit mensaje con el publicacion titulo, subreddit, upvote conteo, y permalink.
Publicar to Slack
Enviar el formatted mensaje to el configured Slack canal via webhook.
Actualizar visto lista
Agregar el nuevo publicacion IDs to el visto lista so they son no alerted on again.
Implementacion en Python
import requests
import json
from pathlib import Path
API_KEY = "your_scavio_api_key"
SLACK_WEBHOOK = "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
def search_reddit(query: str) -> list[dict]:
res = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": API_KEY},
json={"platform": "reddit", "query": query},
timeout=15,
)
res.raise_for_status()
return res.json().get("organic", [])
def send_slack(mentions: list[dict]):
blocks = [{"type": "header", "text": {"type": "plain_text", "text": "New Reddit Mentions"}}]
for m in mentions[:10]:
blocks.append({
"type": "section",
"text": {
"type": "mrkdwn",
"text": f"*<{m['link']}|{m['title']}>*\nr/{m.get('subreddit', 'unknown')} | score: {m.get('score', 0)}",
},
})
requests.post(SLACK_WEBHOOK, json={"blocks": blocks}, timeout=10)
def run():
keywords = ["your-brand", "your-product"]
seen_path = Path("seen_reddit.json")
seen = set(json.loads(seen_path.read_text())) if seen_path.exists() else set()
new_mentions = []
for kw in keywords:
results = search_reddit(kw)
for r in results:
post_id = r.get("link", "")
if post_id and post_id not in seen:
new_mentions.append(r)
seen.add(post_id)
if new_mentions:
send_slack(new_mentions)
print(f"Alerted {len(new_mentions)} new mentions")
else:
print("No new mentions")
seen_path.write_text(json.dumps(list(seen)))
if __name__ == "__main__":
run()Implementacion en JavaScript
const API_KEY = "your_scavio_api_key";
const SLACK_WEBHOOK = "https://hooks.slack.com/services/YOUR/WEBHOOK/URL";
async function searchReddit(query) {
const res = await fetch("https://api.scavio.dev/api/v1/search", {
method: "POST",
headers: {
"x-api-key": API_KEY,
"content-type": "application/json",
},
body: JSON.stringify({ platform: "reddit", query }),
});
if (!res.ok) throw new Error(`scavio ${res.status}`);
const data = await res.json();
return data.organic ?? [];
}
async function sendSlack(mentions) {
const blocks = [
{ type: "header", text: { type: "plain_text", text: "New Reddit Mentions" } },
];
for (const m of mentions.slice(0, 10)) {
blocks.push({
type: "section",
text: {
type: "mrkdwn",
text: `*<${m.link}|${m.title}>*\nr/${m.subreddit ?? "unknown"} | score: ${m.score ?? 0}`,
},
});
}
await fetch(SLACK_WEBHOOK, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ blocks }),
});
}
async function run() {
const fs = await import("fs/promises");
const keywords = ["your-brand", "your-product"];
let seen = new Set();
try {
seen = new Set(JSON.parse(await fs.readFile("seen_reddit.json", "utf8")));
} catch {}
const newMentions = [];
for (const kw of keywords) {
const results = await searchReddit(kw);
for (const r of results) {
if (r.link && !seen.has(r.link)) {
newMentions.push(r);
seen.add(r.link);
}
}
}
if (newMentions.length) {
await sendSlack(newMentions);
console.log(`Alerted ${newMentions.length} new mentions`);
} else {
console.log("No new mentions");
}
await fs.writeFile("seen_reddit.json", JSON.stringify([...seen]));
}
run();Plataformas utilizadas
Comunidad, publicaciones y comentarios en hilos de cualquier subreddit