Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewHeaderBlock does not want to send message #1236

Open
lslavkov opened this issue Oct 3, 2023 · 0 comments
Open

NewHeaderBlock does not want to send message #1236

lslavkov opened this issue Oct 3, 2023 · 0 comments

Comments

@lslavkov
Copy link

lslavkov commented Oct 3, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant