/slack-go-sdk:slack-realtime-eventsfrom slack-go-sdk
Real-time event handling with Socket Mode and Events API. Use when building interactive Slack bots, handling message events, app mentions, reactions, button clicks, modal submissions, slash commands, or any event-driven Slack application functionality.
Ships in slack-go-sdk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use when:
import "github.com/slack-go/slack/socketmode"
client := socketmode.New(
api,
socketmode.OptionDebug(true),
)
See socket-mode-setup.md for complete Socket Mode implementation.
Use when:
See events-api-webhooks.md for HTTP webhook patterns.
api := slack.New(
os.Getenv("SLACK_BOT_TOKEN"),
slack.OptionAppLevelToken(os.Getenv("SLACK_APP_TOKEN")),
)
client := socketmode.New(api)
go func() {
for envelope := range client.Events {
switch envelope.Type {
case socketmode.EventTypeEventsAPI:
client.Ack(*envelope.Request)
// Handle event
}
}
}()
client.Run()
func handleMessageEvent(event *slackevents.MessageEvent, api *slack.Client) {
// Ignore bot messages
if event.BotID != "" {
return
}
fmt.Printf("Message from %s in %s: %s\n", event.User, event.Channel, event.Text)
// Respond
api.PostMessage(event.Channel, slack.MsgOptionText("Got your message!", false))
}
func handleAppMention(event *slackevents.AppMentionEvent, api *slack.Client) {
text := strings.TrimSpace(strings.Replace(event.Text, fmt.Sprintf("<@%s>", botUserID), "", 1))
response := processCommand(text)
api.PostMessage(
event.Channel,
slack.MsgOptionText(response, false),
slack.MsgOptionTS(event.TimeStamp), // Reply in thread
)
}
func handleReaction(event *slackevents.ReactionAddedEvent, api *slack.Client) {
fmt.Printf("User %s added reaction :%s: to message %s\n",
event.User, event.Reaction, event.Item.Timestamp)
// React back
api.AddReaction(event.Reaction, slack.ItemRef{
Channel: event.Item.Channel,
Timestamp: event.Item.Timestamp,
})
}
func handleButtonClick(interaction slack.InteractionCallback, api *slack.Client) {
action := interaction.ActionCallback.BlockActions[0]
switch action.ActionID {
case "approve_deployment":
// Handle approval
updateMessage(api, interaction.Channel.ID, interaction.Message.Timestamp, "Approved!")
case "reject_deployment":
// Handle rejection
updateMessage(api, interaction.Channel.ID, interaction.Message.Timestamp, "Rejected!")
}
}
func handleModalSubmission(interaction slack.InteractionCallback, api *slack.Client) {
values := interaction.View.State.Values
// Extract form data
rating := values["rating_block"]["rating_select"].SelectedOption.Value
comments := values["comments_block"]["comments_input"].Value
// Process submission
fmt.Printf("Feedback: %s stars - %s\n", rating, comments)
// Acknowledge
api.UpdateView(slack.View{}, interaction.View.ExternalID, "", interaction.View.ID)
}
See interactive-components.md for comprehensive interactive patterns.
Handle slash command invocations:
func handleSlashCommand(command slack.SlashCommand, api *slack.Client) slack.Message {
switch command.Command {
case "/deploy":
return slack.Message{
Text: fmt.Sprintf("Deploying %s to %s...", command.Text, "production"),
}
case "/status":
return slack.Message{
Text: "All systems operational",
}
default:
return slack.Message{
Text: "Unknown command",
}
}
}
See slash-commands.md for command patterns and delayed responses.
Common event types to handle:
See event-types.md for comprehensive event catalog.
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
go func() {
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
<-sigChan
cancel()
}()
client.RunContext(ctx)
for envelope := range client.Events {
switch envelope.Type {
case socketmode.EventTypeErrorBadMessage:
fmt.Printf("Error: Bad message - %v\n", envelope.Request)
case socketmode.EventTypeConnectionError:
fmt.Printf("Connection error: %v\n", envelope.Request)
}
}
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub freightcognition/linehaulai-claude-marketplace --plugin slack-go-sdk5 skills in this plugin
/slack-admin-apiEnterprise Grid Admin API operations with the Slack Go SDK. Use when managing organization-wide conversations, assigning or listing admin roles, configuring team settings, restricting channel access, or building internal tooling for Slack workspace/org administrators./slack-auth-securityOAuth flows, token management, and security best practices for Slack apps. Use when implementing app distribution, multi-workspace installations, token storage and rotation, managing scopes and permissions, or securing production Slack applications./slack-client-fundamentalsFoundation 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./slack-web-apiComprehensive guidance for Slack Web API operations with the Go SDK. Use when sending messages, posting to channels, creating or managing channels, retrieving user information, uploading files, composing Block Kit messages, creating or editing Canvases, registering Calls, building an AI Assistant thread, or performing any synchronous Slack API operations.Other plugins' skills for the same job