Skip to content

Commit

Permalink
docs: Adding an example for ConversationHistory (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzoaiello authored Jul 15, 2024
1 parent 7ddfd02 commit 1dfd1df
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/conversation_history/conversation_history.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"context"
"fmt"

"github.com/slack-go/slack"
)

func main() {
api := slack.New("YOUR_TOKEN")
params := slack.GetConversationHistoryParameters{
ChannelID: "C0123456789",
}
messages, err := api.GetConversationHistoryContext(context.Background(), &params)
if err != nil {
fmt.Printf("%s\n", err)
return
}
for _, message := range messages.Messages {
fmt.Printf("Message: %s\n", message.Attachments[0].Color)
}
}

0 comments on commit 1dfd1df

Please sign in to comment.