Push Engagement Summaries to Slack and Email
Engagement data is most useful when it reaches the people who can act on it. Insights delivered to where your team already works get noticed and acted on.
Showpad's Admin Email Digest already delivers a weekly summary to your admin team, and the Dashboard Builder lets admins schedule custom analytics reports by email. Want those same insights in Slack, or reaching managers outside your admin group? You can build that! Your pipeline pulls the engagement data you care about, sends it to your designated LLM, and delivers a structured summary to the channels your team already checks.
Classic Situation
A team wants engagement summaries delivered to managers and content leads in the tools they already use. Doing it manually means:
- Engagement reports require manual review across many deals and reps
- Content performance data exists but nobody has time to analyze it regularly
- Different teams and channels need separate messages, multiplying the distribution effort
- New content drops without any feedback loop on whether it's being used
Solution Example
Schedule a weekly job that exports event data from the Showpad API, sends it to your designated LLM for summarization, and posts a structured digest to a Slack channel or email list.
- Plan: Any Showpad plan with API access
- Permissions: Administrator access to Showpad's Admin App
- Config:
- An LLM API key (examples below use the Anthropic API)
- An
ANTHROPIC_MODELenvironment variable set to the Claude model you want to use (see Claude models) - A Showpad API token with reporting scope
- Slack incoming webhook URL or email delivery configured
- A scheduler (cron, AWS EventBridge, GitHub Actions, etc.)
Steps
1. Export Engagement Events
Use the Showpad API to pull the past seven days of engagement data. Filter to the event types most relevant to your digest.
async function fetchEngagementEvents(showpadToken) {
const endDate = new Date();
const startDate = new Date();
startDate.setDate(startDate.getDate() - 7);
const params = new URLSearchParams({
eventType: ['shared-asset-viewed', 'share-viewed', 'sharedspace-viewed', 'asset-shared'].join(','),
startedAt: startDate.toISOString(),
endedAt: endDate.toISOString(),
limit: '1000',
});
const response = await fetch(`https://{subdomain}.showpad.biz/api/v3/exports/events.json?${params}`, {
headers: { Authorization: `Bearer ${showpadToken}` },
});
const data = await response.json();
return data.response.items;
}
2. Aggregate the Data
Summarize the raw events into a compact representation before sending to the LLM. This reduces token usage and focuses the model on the signals that matter.
Events identify assets and users by ID only. Count by ID first, then look up names for the top results so you only make a handful of extra API calls.
function topByCount(counts, limit) {
return Object.entries(counts)
.sort(([, a], [, b]) => b - a)
.slice(0, limit);
}
async function aggregateEvents(events, showpadToken) {
const headers = { Authorization: `Bearer ${showpadToken}` };
const assetViews = {};
const repActivity = {};
for (const event of events) {
// Count asset views
if (event.type === 'shared-asset-viewed' && event.assetId) {
assetViews[event.assetId] = (assetViews[event.assetId] ?? 0) + 1;
}
// Track rep share activity
if (event.type === 'asset-shared' && event.userId) {
repActivity[event.userId] = (repActivity[event.userId] ?? 0) + 1;
}
}
// Top 10 most-viewed assets, with names
const topAssets = await Promise.all(
topByCount(assetViews, 10).map(async ([assetId, views]) => {
const res = await fetch(`https://{subdomain}.showpad.biz/api/v4/assets/${assetId}`, { headers });
const asset = await res.json();
return { name: asset.name, views };
})
);
// Top 10 reps by shares sent, with names
const topReps = await Promise.all(
topByCount(repActivity, 10).map(async ([userId, shares]) => {
const res = await fetch(`https://{subdomain}.showpad.biz/api/v4/users/${userId}`, { headers });
const user = await res.json();
return { name: `${user.firstName} ${user.lastName}`, shares };
})
);
return {
totalEvents: events.length,
topAssets,
topReps,
period: '7 days',
};
}
3. Generate the Digest with AI
Send the aggregated data to your designated LLM and ask for a structured summary with actionable insights.
Asset names and user names from Showpad engagement events are interpolated into the prompt. In production, validate or sanitize these values before interpolation to prevent prompt injection.
import Anthropic from '@anthropic-ai/sdk';
const anthropic = new Anthropic();
async function generateDigest(aggregated) {
const dataJson = JSON.stringify(aggregated, null, 2);
const response = await anthropic.messages.create({
model: process.env.ANTHROPIC_MODEL, // Any current Claude model ID
max_tokens: 1024,
messages: [
{
role: 'user',
content: `You are a sales enablement analyst. Review this week's Showpad engagement data and write a brief digest for the sales leadership team.
Data:
${dataJson}
Write a digest with these sections:
1. **This Week at a Glance**: 2 to 3 sentences on overall activity
2. **Top Performing Content**: what buyers engaged with most, and what that suggests
3. **Rep Highlights**: who is active and any patterns worth calling out
4. **Recommended Actions**: 2 to 3 concrete suggestions for the content team or managers
Keep the tone direct and business-focused. Use specific numbers from the data. Total length: 200 to 300 words.`,
},
],
});
return response.content.find((block) => block.type === 'text').text;
}
4. Deliver the Digest
Post the digest to Slack or send it as an email. Slack works well for async teams; email is better for stakeholders who don't live in Slack.
async function postToSlack(digest, slackWebhookUrl) {
const weekStart = new Date();
weekStart.setDate(weekStart.getDate() - 7);
const dateRange = `${weekStart.toLocaleDateString()} – ${new Date().toLocaleDateString()}`;
await fetch(slackWebhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
blocks: [
{
type: 'header',
text: { type: 'plain_text', text: `Showpad Weekly Digest: ${dateRange}` },
},
{
type: 'section',
text: { type: 'mrkdwn', text: digest },
},
],
}),
});
}
5. Schedule the Pipeline
Combine the steps and run them on a weekly schedule using your preferred scheduler.
async function runWeeklyDigest() {
const showpadToken = process.env.SHOWPAD_API_TOKEN;
const slackWebhook = process.env.SLACK_WEBHOOK_URL;
const events = await fetchEngagementEvents(showpadToken);
const aggregated = await aggregateEvents(events, showpadToken);
const digest = await generateDigest(aggregated);
await postToSlack(digest, slackWebhook);
console.log('Weekly digest delivered');
}
// Run weekly with cron, AWS EventBridge, or GitHub Actions scheduled workflow
runWeeklyDigest();
Aggregate the data before sending it to the LLM rather than sending raw event arrays. Raw events can be thousands of rows. Compressing them into counts and rankings reduces token usage significantly and gives the model cleaner input to reason over.
Extend the digest by pulling content recommendation data alongside view data. Comparing what reps recommend versus what buyers actually engage with often reveals gaps worth surfacing to the content team.
Was this page helpful?