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.
/plugin marketplace add linehaul-ai/linehaulai-claude-marketplace/plugin install slack-go-sdk@linehaulai-claude-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
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)
}
}
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.