slack-web-api
Slack Web API
Core API Pattern
All Web API methods follow this pattern:
result, err := api.MethodName(params...)
if err != nil {
// Handle error (rate limits, permissions, etc.)
return err
}
// Use result
Messaging Operations
Send Simple Text Message
channelID := "C1234567890"
text := "Hello, Slack!"
_, _, err := api.PostMessage(
channelID,
slack.MsgOptionText(text, false),
)
Send Message with Block Kit
headerText := slack.NewTextBlockObject("mrkdwn", "*Deployment Complete*", false, false)
headerBlock := slack.NewSectionBlock(headerText, nil, nil)
divider := slack.NewDividerBlock()
bodyText := slack.NewTextBlockObject("mrkdwn", "Version 2.1.0 deployed successfully", false, false)
bodyBlock := slack.NewSectionBlock(bodyText, nil, nil)
_, _, err := api.PostMessage(
channelID,
slack.MsgOptionBlocks(headerBlock, divider, bodyBlock),
)
See web-api-messaging.md for comprehensive messaging patterns including threading, updates, and ephemeral messages.
Channel Operations
Create a Channel
channelName := "project-updates"
isPrivate := false
channel, err := api.CreateConversation(channelName, isPrivate)
if err != nil {
return err
}
fmt.Printf("Created channel: %s (ID: %s)\n", channel.Name, channel.ID)
List Channels
params := &slack.GetConversationsParameters{
Types: []string{"public_channel"},
Limit: 100,
}
channels, nextCursor, err := api.GetConversations(params)
See web-api-channels.md for channel management, invites, and metadata operations.
User Operations
Get User Information
user, err := api.GetUserInfo("U1234567890")
if err != nil {
return err
}
fmt.Printf("User: %s (%s)\n", user.Profile.RealName, user.Profile.Email)
List All Users
users, err := api.GetUsers()
if err != nil {
return err
}
for _, user := range users {
fmt.Printf("- %s (%s)\n", user.Name, user.ID)
}
See web-api-users.md for user presence, profiles, and groups.
File Operations
Upload a File
params := slack.FileUploadParameters{
File: "report.pdf",
Channels: []string{"C1234567890"},
Title: "Monthly Report",
}
file, err := api.UploadFile(params)
if err != nil {
return err
}
See web-api-files.md for file downloads, sharing, and multi-part uploads.
Block Kit Integration
Block Kit allows rich, interactive messages. See block-kit-integration.md for:
- Section blocks with text, images, and accessories
- Interactive buttons and select menus
- Input blocks for forms
- Complete layout patterns
Error Handling
Rate Limiting
_, _, err := api.PostMessage(channelID, slack.MsgOptionText(text, false))
if err != nil {
if rateLimitErr, ok := err.(*slack.RateLimitedError); ok {
time.Sleep(rateLimitErr.RetryAfter)
// Retry operation
}
return err
}
Common Error Types
slack.RateLimitedError- Too many requests- Permission errors - Missing scopes
channel_not_found- Invalid channel IDinvalid_auth- Token issues
Pagination
For operations returning large result sets, use cursor-based pagination:
cursor := ""
for {
params := &slack.GetConversationsParameters{
Cursor: cursor,
Limit: 100,
}
channels, nextCursor, err := api.GetConversations(params)
if err != nil {
return err
}
// Process channels...
if nextCursor == "" {
break
}
cursor = nextCursor
}
See pagination-patterns.md for advanced pagination strategies.
Common Pitfalls
- Not handling rate limits (use exponential backoff)
- Hardcoding channel/user IDs (use lookups or environment variables)
- Forgetting to escape user input in messages
- Not validating Bot Token scopes match required permissions
- Using blocking operations in high-throughput scenarios
More from linehaul-ai/linehaulai-claude-marketplace
geospatial-postgis-patterns
Implement geofences, spatial queries, real-time tracking, and mapping features in laneweaverTMS using PostGIS and PGRouting. Use when building location-based features, distance calculations, ETA predictions, or fleet visualization.
83quickbooks-online-api
Expert guide for QuickBooks Online API integration covering authentication, CRUD operations, batch processing, and best practices for invoicing, payments, and customer management.
61rbac-authorization-patterns
Provide patterns for implementing Role-Based Access Control and multi-tenant authorization in laneweaverTMS. Use when implementing user roles, permissions, tenant isolation, Echo authorization middleware, RLS policies for multi-tenant access, or JWT claims structure for freight brokerage applications.
61slack-block-kit
Build Slack Block Kit UIs for messages, modals, and Home tabs. Use when creating Slack notifications, interactive forms, bot responses, app dashboards, or any Slack UI. Covers blocks (Section, Actions, Input, Header), elements (Buttons, Selects, Date pickers), composition objects, and the slack-block-builder library.
44svelte-flow
Build node-based editors, interactive diagrams, and flow visualizations using Svelte Flow. Use when creating workflow editors, data flow diagrams, organizational charts, mindmaps, process visualizations, DAG editors, or any interactive node-graph UI. Supports custom nodes/edges, layouts (dagre, hierarchical), animations, and advanced features like proximity connect, floating edges, and contextual zoom.
34testcontainers-go
Use this skill when writing Go integration tests with Docker containers, using testcontainers-go modules (postgres, redis, kafka, etc.), setting up container-based test infrastructure, or configuring container networking and wait strategies. Covers 62+ pre-configured modules, cleanup patterns, and multi-container setups.
34