NewHeaderBlock does not want to send message
lslavkov opened this issue · comments
Lazar Slavković-Raco commented
What happened
When running a script to send a text through slack.NewHeaderBlock
it displayed that runtime error: invalid memory address or nil pointer dereference
which referred to the block_header.go:34
Expected behavior
Sended a block header formatting to the Slack
Steps to reproduce
reproducible code
headerText := slack.NewTextBlockObject("mrkdwn", "You have a new request:\n*<fakeLink.toEmployeeProfile.com|Fred Enriquez - New device request>*", false, false)
headerSection := slack.NewHeaderBlock(headerText, nil)
blocksExample := []slack.Block{
headerSection,
}
token := os.Getenv("SLACK_AUTH_TOKEN")
channelId := os.Getenv("SLACK_CHANNEL_ID")
client := slack.New(token, slack.OptionDebug(true))
_, block, err := client.PostMessage(channelId, slack.MsgOptionBlocks(blocksExample...))
fmt.Printf("Block: %s\n", block)
if err != nil {
panic(err)
}
Versions
- Go: v1.20.8 linux/amd64
- slack-go/slack: v0.12.3