Slack isn't just a chat app — it has a powerful API that lets you send messages, create workflows, manage channels, and build interactive apps. The free tier is generous enough for most automation projects.
Here's how to start building with it.
Get Your Free API Token
- Go to api.slack.com/apps
- Click "Create New App" → "From scratch"
- Give it a name, select your workspace
- Go to "OAuth & Permissions" → add scopes like
chat:write,channels:read - Install to your workspace → copy the Bot User OAuth Token (starts with
xoxb-)
1. Send a Message to a Channel
curl -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer xoxb-YOUR-TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "C01234567",
"text": "Hello from my bot! :rocket:"
}'
2. Send Rich Messages (Block Kit)
curl -X POST "https://slack.com/api/chat.postMessage" \
-H "Authorization: Bearer xoxb-YOUR-TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "C01234567",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Deploy Complete* :white_check_mark:\nVersion 2.4.1 is live on production."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": "View Logs" },
"url": "https://example.com/logs"
}
]
}
]
}'
3. List Channels
curl "https://slack.com/api/conversations.list" \
-H "Authorization: Bearer xoxb-YOUR-TOKEN"
4. Python — Alert Bot
import requests
SLACK_TOKEN = "xoxb-YOUR-TOKEN"
CHANNEL = "C01234567" # Your channel ID
def send_alert(message, severity="info"):
emoji = {"info": ":information_source:", "warning": ":warning:", "error": ":rotating_light:"}
requests.post("https://slack.com/api/chat.postMessage",
headers={"Authorization": f"Bearer {SLACK_TOKEN}"},
json={
"channel": CHANNEL,
"text": f"{emoji.get(severity, '')} *{severity.upper()}*: {message}"
}
)
# Usage
send_alert("CPU usage above 90%", "warning")
send_alert("Database connection restored", "info")
send_alert("Payment service down!", "error")
5. Node.js — Scheduled Reports
const SLACK_TOKEN = "xoxb-YOUR-TOKEN";
const CHANNEL = "C01234567";
async function sendDailyReport(metrics) {
const blocks = [
{
type: "header",
text: { type: "plain_text", text: "Daily Report" },
},
{
type: "section",
fields: Object.entries(metrics).map(([key, val]) => ({
type: "mrkdwn",
text: `*${key}:*\n${val}`,
})),
},
];
await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
headers: {
Authorization: `Bearer ${SLACK_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ channel: CHANNEL, blocks }),
});
}
sendDailyReport({
"Users Today": "1,234",
"Revenue": "$5,678",
"Errors": "3 (all resolved)",
"Uptime": "99.98%",
});
Rate Limits
| Tier | Methods | Limit |
|---|---|---|
| Tier 1 | chat.postMessage |
1 request/second |
| Tier 2 | conversations.list |
20 requests/minute |
| Tier 3 | users.list |
50 requests/minute |
| Tier 4 | auth.test |
100+ requests/minute |
The free plan has the same API access as paid plans — the limits are per-method, not per-plan.
What You Can Build
- Deploy notifications — post to Slack when CI/CD pipeline completes
- Alert system — server monitoring, error tracking, uptime alerts
- Daily digest bot — summarize metrics, news, or tasks every morning
- Approval workflow — interactive buttons for PR reviews, expense approvals
- Customer support bridge — forward support tickets to Slack channels
- Standup bot — collect daily standups and post summaries
More Free API Articles
- Telegram Has a Free Bot API — Send Messages and Build Bots
- NASA Has a Free API — Mars Rover Photos and Asteroid Data
- Notion Has a Free API — Build Dashboards and Automate Workflows
Need Web Data? Try These Tools
If you're building apps that need web scraping or data extraction, check out my ready-made tools on Apify Store — scrapers for Reddit, YouTube, Google News, Trustpilot, and 80+ more. No coding needed, just run and get your data.
Need a custom scraping solution? Email me at spinov001@gmail.com
More Free APIs You Should Know About
- 30+ Free APIs Every Developer Should Bookmark
- Mapbox Has a Free API
- Claude AI Has a Free API
- SendGrid Has a Free API
- Vercel Has a Free API
- Firebase Has a Free API
- Supabase Has a Free API
- OpenAI Has a Free API
- Twilio Has a Free API
- Stripe Has a Free API
- GitHub API Has a Free API
Need custom data scraping? Email me or check my Apify actors.
Top comments (0)