Foundation skill for Slack Go SDK. Use when setting up a new Slack bot, initializing the API client, choosing between Web API vs Socket Mode vs Events API, implementing error handling patterns, or establishing testing strategies for Slack applications.
64
80%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./plugins/slack-go-sdk/skills/slack-client-fundamentals/SKILL.mdInitialize the Slack API client with your bot token:
import "github.com/slack-go/slack"
api := slack.New("xoxb-your-bot-token")Enable debug mode for development:
api := slack.New(
"xoxb-your-bot-token",
slack.OptionDebug(true),
)Enable built-in retry handling for rate limits (prefer this over hand-rolled backoff):
api := slack.New(
"xoxb-your-bot-token",
slack.OptionRetry(3),
)See client-configuration.md for full retry configuration, including retrying connection errors and 5xx responses.
Use for direct API calls where you initiate the action:
Use when your app runs behind a firewall and can't receive HTTP requests:
Use when you have a publicly accessible endpoint:
Always handle errors from API calls:
_, _, err := api.PostMessage(channelID, slack.MsgOptionText(text, false))
if err != nil {
// Handle specific error types
if rateLimitedError, ok := err.(*slack.RateLimitedError); ok {
// Wait and retry
time.Sleep(rateLimitedError.RetryAfter)
}
return fmt.Errorf("failed to post message: %w", err)
}Use context for cancellation and timeouts:
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// Pass context to API methods that support itslack-bot/
├── cmd/
│ └── bot/
│ └── main.go # Entry point
├── internal/
│ ├── handlers/
│ │ ├── messages.go # Message handlers
│ │ ├── events.go # Event handlers
│ │ └── commands.go # Slash command handlers
│ ├── slack/
│ │ ├── client.go # Slack client wrapper
│ │ └── middleware.go # Authentication, rate limiting
│ └── config/
│ └── config.go # Configuration management
├── pkg/
│ └── models/ # Shared data models
├── go.mod
└── go.sumSee testing-patterns.md for comprehensive testing guidance including:
slacktest mock server (preferred for bot integration tests)For advanced configuration including custom HTTP clients, retry strategies, and rate limiting:
Based on your use case, explore these skills:
slack-web-api skill for messaging, channels, users, filesslack-realtime-events skill for Socket Mode or Events APIslack-auth-security skill for multi-workspace authentication88571a6
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.