From ca60d3c9d4d66fc8da02c1666057d04ae26e5a6f Mon Sep 17 00:00:00 2001 From: descholar-ceo Date: Thu, 20 Aug 2020 07:44:28 +0200 Subject: [PATCH] Add explanation how the message could be sent in a proper way Add slack.MsgOptionAsUser(true) to the api.PostMessage so that the route of response will come from the bot itself --- examples/messages/messages.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/messages/messages.go b/examples/messages/messages.go index 20e8f19a9..dd7f02da0 100644 --- a/examples/messages/messages.go +++ b/examples/messages/messages.go @@ -22,7 +22,12 @@ func main() { */ } - channelID, timestamp, err := api.PostMessage("CHANNEL_ID", slack.MsgOptionText("Some text", false), slack.MsgOptionAttachments(attachment)) + channelID, timestamp, err := api.PostMessage( + "CHANNEL_ID", + slack.MsgOptionText("Some text", false), + slack.MsgOptionAttachments(attachment), + slack.MsgOptionAsUser(true), // Add this if you want that the bot would post message as a user, otherwise it will send response using the default slackbot + ) if err != nil { fmt.Printf("%s\n", err) return