Built for startups,
scaled for unicorns
Successfully submitted!
Error! Please try again
Competition drives referral programs β and nothing fuels healthy competition like a public leaderboard. A Slack leaderboard bot that posts daily rankings of your top referrers creates visibility, motivates participants, and gamifies your referral program. When team members and customers see who's leading, they're more likely to step up their sharing game.
This guide covers building a Slack bot that automatically pulls referral data from GrowSurf's API, ranks participants by referral count, and posts a formatted leaderboard to a Slack channel on a daily or weekly schedule.
Configure API keys and credentials for GrowSurf and Slack.
Create a function that pulls participant data from GrowSurf's API and ranks them by referral count.
GET /v2/campaign/{campaignId}/participantsreferralCount descendingDesign a Slack Block Kit message that presents the leaderboard in an engaging, scannable format.
Set up a scheduled job that runs daily to post the leaderboard automatically.
Make the leaderboard interactive and engaging beyond a simple list.
Create a Slack slash command that lets team members check referral stats anytime.
/referrals/referrals leaderboard β show current top 10/referrals stats β show program summary stats/referrals [email] β look up a specific participant's referral stats// GrowSurf Referral Leaderboard Bot for Slack
const axios = require('axios');
const cron = require('node-cron');
const GROWSURF_API = 'https://api.growsurf.com/v2';
const CAMPAIGN_ID = process.env.GROWSURF_CAMPAIGN_ID;
async function getTopReferrers(limit = 10) {
const response = await axios.get(
`${GROWSURF_API}/campaign/${CAMPAIGN_ID}/participants?limit=100&order=desc&orderBy=referralCount`,
{ headers: { 'Authorization': `Bearer ${process.env.GROWSURF_API_KEY}` } }
);
return response.data.participants
.filter(p => p.referralCount > 0)
.slice(0, limit);
}
function formatLeaderboard(participants) {
const medals = ['π₯', 'π₯', 'π₯'];
const today = new Date().toLocaleDateString('en-US', {
weekday: 'long', month: 'long', day: 'numeric'
});
let leaderboardText = participants.map((p, i) => {
const rank = i < 3 ? medals[i] : `${i + 1}.`;
const name = p.firstName ? `${p.firstName} ${p.lastName || ''}` : p.email;
return `${rank} *${name.trim()}* β ${p.referralCount} referrals`;
}).join('\n');
const totalReferrals = participants.reduce((sum, p) => sum + p.referralCount, 0);
return {
blocks: [
{
type: 'header',
text: { type: 'plain_text', text: `Referral Leaderboard β ${today}` }
},
{
type: 'section',
text: { type: 'mrkdwn', text: leaderboardText }
},
{ type: 'divider' },
{
type: 'context',
elements: [{
type: 'mrkdwn',
text: `Total referrals: *${totalReferrals}* | Top ${participants.length} referrers shown`
}]
}
]
};
}
// Post leaderboard daily at 9 AM
cron.schedule('0 9 * * *', async () => {
const topReferrers = await getTopReferrers(10);
const message = formatLeaderboard(topReferrers);
await axios.post(process.env.SLACK_WEBHOOK_URL, message);
});If your referral program includes external participants (not just employees), get consent before displaying names on a public leaderboard. Use first names only or anonymize with initials. For internal programs, full names are usually fine.
In addition to the daily leaderboard, post a weekly "awards" message every Friday that highlights: Top Referrer of the Week, Biggest Mover (most improvement), and Newcomer Award (best new participant). This creates additional recognition moments.
Store the previous day's leaderboard data so you can show rank changes (up/down arrows) and highlight movers. Use a simple JSON file or Redis cache to store yesterday's rankings and compare against today's data.
Yes. GrowSurf's API returns all participants regardless of whether they're internal or external. You can filter by email domain (e.g., only show @yourcompany.com for internal leaderboards) or show everyone for public-facing programs. Use separate Slack channels for internal vs. external leaderboards.
When two participants have the same referral count, sort by who reached that count first (using their last referral date). This rewards consistency and speed. Alternatively, display tied participants at the same rank and skip the next rank number.
Yes. Create a points system in your handler: 1 point per referral, 3 points per conversion, 5 points for high-value conversions. Pull conversion data from GrowSurf's API or your CRM, calculate point totals, and rank by points instead of raw referral count. This rewards quality over quantity.
Trusted by marketing and product teams at fast-growing B2C, fintech, and SaaS companies
