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

MetaData doesn't work with PostMessage #1343

Open
nivzx opened this issue Nov 1, 2024 · 0 comments
Open

MetaData doesn't work with PostMessage #1343

nivzx opened this issue Nov 1, 2024 · 0 comments

Comments

@nivzx
Copy link

nivzx commented Nov 1, 2024

What happened

Assigning metadata with client.PostMessage, it didn't work.

Expected behavior

Assigning MetaData using MsgOptionPostMessageParameters() (like in here) should include given key-value pair in the message metadata.

Steps to reproduce

  • Post a message to a channel with MetaData defined, and log the received message event. In the posted message event, the event_type and event_payload of MetaData are empty.
...
"metadata": {
    "event_type": "",
    "event_payload": null
},
...

reproducible code

package handlers

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

func main {
	api = slack.New("xoxb-xxx")

	// Define PostMessageParameters
	messageParameters := slack.PostMessageParameters{
		MetaData: slack.SlackMetadata{
			EventType: "reaction_added",
			EventPayload: map[string]interface{}{
				"event_id": "123",
			},
		},
	}

	// Post a message to a channel with the created messageParameters
	_, _, err := api.PostMessage(
		"channel-name",
		slack.MsgOptionText("Hello", false),
		slack.MsgOptionPostMessageParameters(messageParameters),
	)
}

Versions

  • Go: 1.23
  • slack-go/slack: 0.15.0
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