diff --git a/examples/conversation_history/conversation_history.go b/examples/conversation_history/conversation_history.go new file mode 100644 index 000000000..569c12d68 --- /dev/null +++ b/examples/conversation_history/conversation_history.go @@ -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(), ¶ms) + if err != nil { + fmt.Printf("%s\n", err) + return + } + for _, message := range messages.Messages { + fmt.Printf("Message: %s\n", message.Attachments[0].Color) + } +}